Compare commits
88 Commits
async-dial
...
gtk-1-3-wi
Author | SHA1 | Date | |
---|---|---|---|
|
3dab4659bf | ||
|
03e4664a1c | ||
|
ffb8606928 | ||
|
d5927d43b1 | ||
|
a9fb56f336 | ||
|
0f1f73ec37 | ||
|
ab0b717cb8 | ||
|
94e6913a28 | ||
|
c2894650d6 | ||
|
81add74bb2 | ||
|
219c35fdd5 | ||
|
5b4a8842e7 | ||
|
f61dffae75 | ||
|
f86b1a57fe | ||
|
ad0fd37b31 | ||
|
f139bcb69d | ||
|
8a1457e100 | ||
|
3a2d421feb | ||
|
c58504d731 | ||
|
bafb577769 | ||
|
8471793f5f | ||
|
3c1bfb6ad2 | ||
|
5d6a12e109 | ||
|
f4fdd9e262 | ||
|
b21c381532 | ||
|
cbb3b4e07d | ||
|
4ea98cbe1a | ||
|
84d9defe96 | ||
|
218386c7e6 | ||
|
f0532dc0de | ||
|
b733ebda81 | ||
|
4b6c14f8de | ||
|
1c60270352 | ||
|
edf8e89542 | ||
|
68a50d31a2 | ||
|
c01594a97c | ||
|
8bb8d2e7f1 | ||
|
53f7005ca6 | ||
|
39a6e943f5 | ||
|
260ed9f176 | ||
|
9306a53a50 | ||
|
5c59e277ae | ||
|
cd14721291 | ||
|
9863dfa44c | ||
|
62e41803eb | ||
|
3247b1d687 | ||
|
889863e454 | ||
|
293cde2040 | ||
|
663b69cfa2 | ||
|
0a32e7a666 | ||
|
41ff22e71d | ||
|
1b59831515 | ||
|
e346381dab | ||
|
116a66a769 | ||
|
afed946500 | ||
|
320761ec35 | ||
|
cb25493118 | ||
|
dc8487995a | ||
|
7d9357860f | ||
|
f772609e37 | ||
|
772d1338cb | ||
|
df61f63589 | ||
|
518317f6ff | ||
|
c70bff30a8 | ||
|
c4721d19d3 | ||
|
50e2e00899 | ||
|
b350c23671 | ||
|
9b1bbdfc4d | ||
|
18fe65ee55 | ||
|
bc893e2130 | ||
|
f7e1740411 | ||
|
a2fc680bff | ||
|
65ee13db63 | ||
|
702588a970 | ||
|
8f72187e2d | ||
|
323603519f | ||
|
2ea0188760 | ||
|
4a430f2f56 | ||
|
da07edf39a | ||
|
6a3b65afa7 | ||
|
73473c5998 | ||
|
238ffeda07 | ||
|
5d0b1d3690 | ||
|
b6e03db310 | ||
|
bc1b63a981 | ||
|
33a2d9daea | ||
|
065f473674 | ||
|
5c05a787fb |
@@ -9,15 +9,12 @@ Makefile
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
configure
|
||||
gtk-config-2.0
|
||||
gtk-config
|
||||
config.cache
|
||||
ABOUT-NLS
|
||||
intl
|
||||
stamp-h.in
|
||||
gtk+.spec
|
||||
gtk+-2.0.pc
|
||||
gdk-2.0.pc
|
||||
gdk-pixbuf-2.0.pc
|
||||
missing
|
||||
install-sh
|
||||
mkinstalldirs
|
||||
|
7577
ChangeLog.pre-2-0
7747
ChangeLog.pre-2-10
7726
ChangeLog.pre-2-2
7747
ChangeLog.pre-2-4
7747
ChangeLog.pre-2-6
7747
ChangeLog.pre-2-8
27
INSTALL
@@ -1,31 +1,14 @@
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
GTK+ requires the following packages:
|
||||
|
||||
- The GLIB library, available at the same location as GTK+
|
||||
|
||||
- The Pango library, available from:
|
||||
|
||||
http://www.pango.org/download.shtml
|
||||
|
||||
- The TIFF, PNG, and JPEG image loading libraries. You most
|
||||
likely have these installed on your system already. If not
|
||||
these libraries are available from:
|
||||
|
||||
http://www.libtiff.org/
|
||||
http://www.libpng.org/
|
||||
ftp://ftp.uu.net/graphics/jpeg/
|
||||
|
||||
If these libraries are not available, the corresponding
|
||||
image loaders will simply not be built. However, this
|
||||
may cause applications using GTK+ not to function properly.
|
||||
GTK+ requires the GLIB library, available at the same location as
|
||||
you got this package.
|
||||
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-1.3.2.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.3.2 # change to the toplevel directory
|
||||
% gzip -cd gtk+-1.3.0.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.3.0 # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK
|
||||
[ Become root if necessary ]
|
||||
@@ -135,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.3.2
|
||||
./configure --with-glib=../glib-1.3.0
|
||||
|
||||
This, however, will not work if you built GLIB with different
|
||||
source and build directories.
|
||||
|
25
INSTALL.in
@@ -1,29 +1,8 @@
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
GTK+ requires the following packages:
|
||||
|
||||
- The GLIB library, available at the same location as GTK+
|
||||
|
||||
- The Pango library, available from:
|
||||
|
||||
http://www.pango.org/download.shtml
|
||||
|
||||
Pango also requires the FriBidi library, available from:
|
||||
|
||||
http://imagic.weizmann.ac.il/~dov/freesw/FriBidi/
|
||||
|
||||
- The TIFF, PNG, and JPEG image loading libraries. You most
|
||||
likely have these installed on your system already. If not
|
||||
these libraries are available from:
|
||||
|
||||
http://www.libtiff.org/
|
||||
ftp://swrinde.nde.swri.edu/pub/png/src/
|
||||
ftp://ftp.uu.net/graphics/jpeg/
|
||||
|
||||
If these libraries are not available, the corresponding
|
||||
image loaders will simply not be built. However, this
|
||||
may cause applications using GTK+ not to function properly.
|
||||
GTK+ requires the GLIB library, available at the same location as
|
||||
you got this package.
|
||||
|
||||
Simple install procedure
|
||||
========================
|
||||
|
60
Makefile.am
@@ -1,45 +1,35 @@
|
||||
## Makefile.am for GTK+
|
||||
|
||||
SRC_SUBDIRS = gdk-pixbuf gdk modules gtk demos contrib
|
||||
SUBDIRS = po $(SRC_SUBDIRS) docs build
|
||||
SRC_SUBDIRS = gdk gtk
|
||||
SUBDIRS = po $(SRC_SUBDIRS) build docs
|
||||
|
||||
bin_SCRIPTS = gtk-config-2.0
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA= gdk-1.3-win32-production.pc gtk+-1.3-win32-production.pc
|
||||
|
||||
# require automake 1.4
|
||||
AUTOMAKE_OPTIONS = 1.4
|
||||
|
||||
EXTRA_DIST = \
|
||||
HACKING \
|
||||
gtk+.spec.in \
|
||||
gtk-2.0.m4 \
|
||||
makecopyright \
|
||||
TODO \
|
||||
TODO.xml \
|
||||
NEWS.pre-1-0 \
|
||||
EXTRA_DIST = \
|
||||
HACKING \
|
||||
gtk.m4 \
|
||||
makecopyright \
|
||||
TODO \
|
||||
NEWS.pre-1-0 \
|
||||
ChangeLog.pre-1-0 \
|
||||
ChangeLog.pre-1-2 \
|
||||
README.cvs-commits \
|
||||
README.win32 \
|
||||
README.nanox \
|
||||
intl/libgettext.h \
|
||||
intl/po2tbl.sed.in \
|
||||
po/README.tools \
|
||||
po/README.translators \
|
||||
po/desk.pl \
|
||||
po/makefile.mingw \
|
||||
po/update.pl \
|
||||
README.win32 \
|
||||
config.h.win32 \
|
||||
gtk+-1.3-win32-production.pc.in \
|
||||
gdk-1.3-win32-production.pc.in \
|
||||
gtk+-zip.sh \
|
||||
examples/aspectframe/Makefile \
|
||||
examples/aspectframe/aspectframe.c \
|
||||
examples/Makefile \
|
||||
examples/README.1ST \
|
||||
examples/extract.awk \
|
||||
examples/extract.sh \
|
||||
examples/arrow/Makefile \
|
||||
examples/arrow/arrow.c \
|
||||
examples/base/Makefile \
|
||||
examples/base/base.c \
|
||||
examples/buttonbox/Makefile \
|
||||
examples/buttonbox/buttonbox.c \
|
||||
examples/buttons/Makefile \
|
||||
examples/buttons/buttons.c \
|
||||
examples/buttons/info.xpm \
|
||||
@@ -61,8 +51,6 @@ EXTRA_DIST = \
|
||||
examples/helloworld/helloworld.c \
|
||||
examples/helloworld2/Makefile \
|
||||
examples/helloworld2/helloworld2.c \
|
||||
examples/label/Makefile \
|
||||
examples/label/label.c \
|
||||
examples/list/Makefile \
|
||||
examples/list/list.c \
|
||||
examples/menu/Makefile \
|
||||
@@ -88,8 +76,6 @@ EXTRA_DIST = \
|
||||
examples/rulers/rulers.c \
|
||||
examples/scribble-simple/Makefile \
|
||||
examples/scribble-simple/scribble-simple.c \
|
||||
examples/scribble-xinput/Makefile \
|
||||
examples/scribble-xinput/scribble-xinput.c \
|
||||
examples/scrolledwin/Makefile \
|
||||
examples/scrolledwin/scrolledwin.c \
|
||||
examples/selection/Makefile \
|
||||
@@ -117,20 +103,8 @@ EXTRA_DIST = \
|
||||
examples/spinbutton/Makefile \
|
||||
examples/find-examples.sh
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA= gdk-pixbuf-2.0.pc gdk-2.0.pc gtk+-2.0.pc
|
||||
|
||||
dist-hook: gtk+.spec
|
||||
if test -e $(srcdir)/INSTALL.in && test -e $(srcdir)/README.in ; then \
|
||||
CONFIG_FILES="INSTALL:$(srcdir)/INSTALL.in README:$(srcdir)/README.in" \
|
||||
CONFIG_HEADERS= \
|
||||
$(SHELL) config.status \
|
||||
&& cp INSTALL README $(distdir) ; \
|
||||
fi \
|
||||
&& cp gtk+.spec $(distdir)
|
||||
|
||||
m4datadir = $(datadir)/aclocal
|
||||
m4data_DATA = gtk-2.0.m4
|
||||
m4data_DATA = gtk.m4
|
||||
|
||||
.PHONY: files release sanity snapshot
|
||||
|
||||
@@ -154,4 +128,4 @@ sanity:
|
||||
|
||||
|
||||
snapshot:
|
||||
$(MAKE) dist distdir=$(PACKAGE)-snap`date +"%Y%m%d"`
|
||||
$(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
|
||||
|
104
NEWS
@@ -1,107 +1,3 @@
|
||||
Overview of Changes in GTK+ 1.3.2
|
||||
=================================
|
||||
|
||||
GTK Core:
|
||||
|
||||
* New stock-icon and stock-item system. Use themeable pixbufs in
|
||||
dialogs, buttons, etc. [Havoc]
|
||||
* Theme engines reworked to use derivation and new object system. [Owen]
|
||||
* Added GtkClipboard object for simple selection handling. [Owen]
|
||||
* Make GtkEditable an interface, move implementation to GtkOldEditable for
|
||||
compat. [Owen]
|
||||
* Better handling of default directionality. [Robert]
|
||||
* Use GSignal as backend for GtkSignal and other GObject stuff. [Tim]
|
||||
* Move theme engines to GTypePlugin. [Owen]
|
||||
|
||||
GDK:
|
||||
|
||||
* Beginning of implementation of client parts of new window manager spec. [Owen]
|
||||
* Make gdk_drawable_get_image() work with backing store. [Havoc]
|
||||
|
||||
Widgets:
|
||||
|
||||
* New text widget [Havoc]
|
||||
- Adjustable tab handling.
|
||||
- Ability to have scrolling side areas in new text widget for tabs/line numbers.
|
||||
- Many cleanups and small improvements.
|
||||
* Improvements to submenu navigation [Nils Barth/David Santiago] and
|
||||
scrolling menus. [Alex]
|
||||
* Simplification of progress bar API. [Havoc]
|
||||
* Make GtkImage a generic image-display widget. [Havoc]
|
||||
* New GtkTreeView tree widget. Model/view architecture, flexible renderering,
|
||||
large datasets, etc. [Jonathan]
|
||||
* New GtkMessageBox widget for message display. [Havoc]
|
||||
* Allow labels to have contents set from XML-like markup language. [Havoc]
|
||||
* Make dialogs derive from GtkDialog and use stock buttons. [Havoc]
|
||||
|
||||
Internationalization:
|
||||
|
||||
* Proper character set conversion for clipboard/selection. [Owen]
|
||||
* New input method system via loadable modules; support on-the-spot
|
||||
preedit in GtkEntry and new text widget; allow switchin input methods
|
||||
on the fly; include modules for XIM and demo Cyrillic-tranliteration
|
||||
module. [Owen]
|
||||
* VIQR, Thai, and Inuktitut input methods. [Robert]
|
||||
* Convert po files to UTF-8. [Robert]
|
||||
|
||||
gdk-pixbuf:
|
||||
|
||||
* Full-alpha compositing for gdk-pixbuf on drawable. [Havoc]
|
||||
* Add simple saving to gdk-pixbuf. [David Welton/Havoc]
|
||||
* Add improved error handling with GError to gdk-pixbuf. [Havoc]
|
||||
|
||||
Ports:
|
||||
|
||||
* Much work on Win32 Port. [Tor/Hans]
|
||||
* Much work on Linux-FB Port. [Elliot/Alex]
|
||||
|
||||
Misc:
|
||||
|
||||
* Start of new gtk-demo demo program. [Owen/Jonathan]
|
||||
* Bug fixes and more bug fixes.
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 1.3.1:
|
||||
|
||||
* GTK+ now uses the Pango library for text manipulation. All
|
||||
strings in GTK+ now are in Unicode, languages written
|
||||
from right-to-left, and complex-text languages are now supported.
|
||||
* The gdk-pixbuf library for image loading and manipulation is
|
||||
has been integrated with GTK+.
|
||||
* The GTK+ object system has mostly been moved to GLib, separating
|
||||
it from the GUI code. Many significant enhancements have been
|
||||
made as part of this.
|
||||
* A new text widget is now included. This started as a port
|
||||
of the Tk text widget, and includes such features of the Tk
|
||||
text widget as tags, marks, and unicode text support. It
|
||||
has been enhanced to support model-view operation and the
|
||||
full power of Pango.
|
||||
* The GDK library has been extensively revised to support multiple
|
||||
windowing systems. The only fully functional backend in 1.3.1
|
||||
is the X11 backend, however, ports to Win32, Linux-framebuffer,
|
||||
Nano-X, BeOS, and MacOS exist in various states of completion,
|
||||
and at least some of these will be finished and integrated in
|
||||
before the final GTK+-2.0 release.
|
||||
* 32-bit coordinates are now supported throughout GDK and GTK+
|
||||
(they are emulated where not supported by the windowing system.)
|
||||
* Many minor bug fixes and enhancements. Incompatible changes
|
||||
are documented in docs/Changes-2.0.txt
|
||||
|
||||
Overview of Changes in GTK+ 1.2.8:
|
||||
|
||||
* GNU Make 3.79 bug workaround
|
||||
* FAQ and tutorial updates and improvements
|
||||
* Miscellaneous bug fixes: CList, Calendar, rc-files, FontSelection
|
||||
|
||||
Overview of Changes in GTK+ 1.2.7:
|
||||
|
||||
* More header cleanups.
|
||||
* Fixed activation bug for insensitive widgets.
|
||||
* Locale fixes to RC file parsing code.
|
||||
* Miscellaneous bugfixes for Item Factory, CList, CTree, X Selections,
|
||||
HScale, VScale, Pixmap, Viewport, OptionMenu, Entry and Notebook.
|
||||
* Upgrade to libtool 1.3.4.
|
||||
|
||||
Overview of Changes in GTK+ 1.2.6:
|
||||
|
||||
* container queue_resize fixes
|
||||
|
11
README
@@ -1,7 +1,7 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
This is GTK+ version 1.3.2. GTK+, which stands for the Gimp ToolKit,
|
||||
This is GTK+ version 1.3.0. 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.
|
||||
@@ -21,7 +21,8 @@ To subscribe: mail -s subscribe gtk-list-request@redhat.com < /dev/null
|
||||
Installation
|
||||
============
|
||||
|
||||
See the file 'INSTALL'
|
||||
This is the gtk-1-3-win32-production branch, intended only for
|
||||
Windows. See README.win32.
|
||||
|
||||
How to report bugs
|
||||
==================
|
||||
@@ -37,9 +38,9 @@ version number. This should be separated by a blank
|
||||
line from the actual headers.
|
||||
|
||||
Package: gtk+
|
||||
Version: 1.3.2
|
||||
Version: 1.3.0
|
||||
|
||||
[ Please substitute 1.3.2 with the version of GTK+ that
|
||||
[ Please substitute 1.3.0 with the version of GTK+ that
|
||||
you have installed ]
|
||||
|
||||
Then describe the bug. Include:
|
||||
@@ -82,7 +83,7 @@ From: yourname@your.address.org
|
||||
Subject: handlebox test in testgtk is misnamed.
|
||||
|
||||
Package: gtk+
|
||||
Version: 1.3.2
|
||||
Version: 1.3.0
|
||||
|
||||
When I run gtk/testgtk, the button "handle box"
|
||||
is misnamed. There are multiple handle boxes in
|
||||
|
@@ -21,7 +21,8 @@ To subscribe: mail -s subscribe gtk-list-request@redhat.com < /dev/null
|
||||
Installation
|
||||
============
|
||||
|
||||
See the file 'INSTALL'
|
||||
This is the gtk-1-3-win32-production branch, intended only for
|
||||
Windows. See README.win32.
|
||||
|
||||
How to report bugs
|
||||
==================
|
||||
|
32
README.nanox
@@ -1,32 +0,0 @@
|
||||
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.
|
||||
Provide a pango module.
|
||||
|
||||
If you want to work on this port or get additional informnation, get in
|
||||
touch with me.
|
||||
Configure gtk with the --with-gdktarget=nanox to compile with nano-X support.
|
||||
|
||||
Paolo Molaro
|
||||
lupus@linuxcare.com
|
||||
|
118
README.win32
@@ -1,48 +1,94 @@
|
||||
The Win32 port of GTk+ is a work in progress, and not as stable or
|
||||
The Win32 port of GTK is a work in progress, and not as stable or
|
||||
correct as the Unix/X11 version. For more information about the Win32
|
||||
port, see http://www.gimp.org/win32/ or
|
||||
port, see http://www.gimp.org/tml/gimp/win32/ or
|
||||
http://www.iki.fi/tml/gimp/win32/ .
|
||||
|
||||
This current (CVS) version of the Win32 backend does *not* necessarily
|
||||
even compile properly. A zipfile with an older snapshot (from before
|
||||
the merge of the no-flicker branch, and the other recent additions),
|
||||
is available from http://www.gimp.org/win32/. That should be used by
|
||||
"production" code until this CVS version is useable. (But note, the
|
||||
Win32 backend has never been claimed to be "production quality",
|
||||
although it works OK for the GIMP.)
|
||||
The current (CVS HEAD) version of the Win32 backend does not
|
||||
necessarily work properly. The code here is the
|
||||
gtk-1-3-win32-production branch that was branched off from before the
|
||||
addition of the no-flicker and other recent functionality. This is
|
||||
what should be used by "production" code until the CVS HEAD version is
|
||||
useable. (But note, the Win32 backend has never been claimed to be
|
||||
"production quality", although it works surprisingly well for the
|
||||
GIMP.)
|
||||
|
||||
To build GTk+ on Win32, you need either gcc-2.95 or later, or the
|
||||
Microsoft compiler and tools. 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 `make -f makefile.mingw` (gcc) or `nmake
|
||||
-f makefile.msc` (MSVC). The name makefile.mingw needs an explanation:
|
||||
It refers to the target, not the build environment. As build
|
||||
env<EFBFBD>ronment, only cygwin is tested. GNU Make is definitely needed.
|
||||
Building GTK+ on Win32
|
||||
======================
|
||||
|
||||
See the README.win32 file in the GLib distribution for instructions
|
||||
how to build with gcc.
|
||||
There are three ways to build gtk for win32:
|
||||
|
||||
To use GTk+ on Win32, you also need either one of the above mentioned
|
||||
compilers. Other compilers might work, but don't count on it. The
|
||||
same instructions on how to set up a correct version of gcc should
|
||||
also be followed if you want to build applications that use GTk+ with
|
||||
gcc.
|
||||
1) Use the autoconf-generated configure script, and the resulting
|
||||
Makefiles (which use libtool and gcc to do the compilation). I use
|
||||
this myself, but it might be hell to setup correctly.
|
||||
|
||||
Personally I run configure like this:
|
||||
|
||||
CC='gcc -mpentium -fnative-struct' CPPFLAGS='-I/target/include' CFLAGS=-O2 LDFLAGS='-L/target/lib' ./configure --disable-static --prefix=/target --with-wintab=/src/wtkit126 --with-ie55=/src/workshop/ie55_lib --host=i386-pc-mingw32 --enable-maintainer-mode
|
||||
|
||||
2) Use gcc from mingw, or gcc -mno-cygwin from Cygwin. Say make -f
|
||||
makefile.mingw in gdk and gtk.
|
||||
|
||||
3) Use the Microsoft compiler, cl and Make, nmake. Say nmake -f
|
||||
makefile.msc in gdk and gtk.
|
||||
|
||||
Alternatives 1 and 2 also generate Microsoft import libraries (.lib),
|
||||
if you have lib.exe available. They should also work for
|
||||
cross-compilations from Unix, as long as you pass the correct compiler
|
||||
name.
|
||||
|
||||
Note that I use mainly gcc myself, and thus the build setup for
|
||||
Microsoft's nmake and cl might be a bit rusty. Hans Breuer has been
|
||||
taking care of them. At times, I and he disagree a bit, and the gcc
|
||||
and msc makefiles might not produce compatible or identically named
|
||||
DLLs and import libraries.
|
||||
|
||||
Using GTK+ on Win32
|
||||
===================
|
||||
|
||||
To use GTK on Win32, you also need either gcc or MSVC. Other compilers
|
||||
might work, but don't count on it. Note that if you use gcc, in order
|
||||
to use the prebuilt DLLs, you *must* compile your code with gcc
|
||||
-mno-cygwin -fnative-struct.
|
||||
|
||||
Multi-threaded use of GTK+ on Win32
|
||||
===================================
|
||||
|
||||
Multi-threaded GTK+ programs might work in special simple cases, but
|
||||
not in general. Sorry. If you have all GTK+ and GDK calls in the same
|
||||
thread, it might work. Otherwise, probably not at all. Possible ways
|
||||
to fix this are being investigated.
|
||||
|
||||
Wintab
|
||||
======
|
||||
|
||||
The tablet support uses the Wintab API. The Wintab development kit can
|
||||
be downloaded from http://www.pointing.com. If you don't care for
|
||||
that, undefine HAVE_WINTAB in config.h.win32 and remove references to
|
||||
that, undefine HAVE_WINTAB_H in config.h.win32 and remove references to
|
||||
the wntab32x library from the makefile before building.
|
||||
|
||||
GTk+ wants to be built with the GNU "intl" library for
|
||||
internationalisation (i18n). Get the version ported to Win32 (not a
|
||||
very big deal) from tml's web site mentioned above. We build the
|
||||
"intl" library as a DLL called gnu-intl.dll (the "gnu" prefix is used
|
||||
to reduce name clash risks). If you don't want any i18n stuff,
|
||||
undefine ENABLE_NLS, HAVE_GETTEXT and HAVE_LIBINTL in the
|
||||
config.h.win32 file, and remove references to the gnu-intl library
|
||||
from the makefiles.
|
||||
Libintl
|
||||
=======
|
||||
|
||||
Note that while the GNU gettext package is under the GPL license, the
|
||||
"intl" part of it is also distributed as part of the GNU C library
|
||||
(glibc) where it is under the LGPL license (as is GTk+ or GLib). We
|
||||
want the LGPL licensed version. The code is more or less the same.
|
||||
GTK wants to be built with the GNU "intl" library for
|
||||
internationalisation (i18n). Get the version ported to Win32 (not a
|
||||
very big deal) from the web site mentioned above. The "intl" library
|
||||
as gets built as a DLL called libintl-1.dll. If you don't want any
|
||||
i18n stuff, undefine ENABLE_NLS, HAVE_GETTEXT and HAVE_LIBINTL in the
|
||||
config.h.win32 file, and remove references to the intl library from
|
||||
the makefiles.
|
||||
|
||||
Note that while the GNU gettext package is under the GPL, the "intl"
|
||||
part of it is under the LGPL (like GTK or GLib), as of
|
||||
gettext-0.10.40.
|
||||
|
||||
ActiveIMM
|
||||
=========
|
||||
|
||||
If you want to build a GTK+ that supports ActiveIMM (the Input Method
|
||||
Manager for non-EastAsia locales that can be used on Win9x/NT4), you
|
||||
need the dimm.h header file. That is somewhat difficult to find, but
|
||||
http://msdn.microsoft.com/downloads/samples/internet/wizard/ seems to
|
||||
be a good place to look nowadays. If you use autoconfiscated build,
|
||||
pass the --with-ie55 flag to configure specifyin the location of the
|
||||
ie55_lib directory created by downloading the IE5.5 headers and libs
|
||||
from the above URL.
|
||||
|
435
TODO.xml
@@ -12,7 +12,7 @@
|
||||
<section>
|
||||
<title>GDK</title>
|
||||
|
||||
<entry size="medium" status="90%" target="2.0">
|
||||
<entry size="medium" status="70%" target="1.4">
|
||||
<title>Add backing store support</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -39,7 +39,7 @@
|
||||
<contact>Owen Taylor <otaylor@redhat.com></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="90%" target="2.0">
|
||||
<entry size="medium" status="70%" target="1.4">
|
||||
<title>32 Bit Coordinates</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -60,7 +60,7 @@
|
||||
<contact>Owen Taylor <otaylor@redhat.com></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="2.0">
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Customizable double-click timeout</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -69,61 +69,15 @@
|
||||
customizable
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
<contact>gtk-devel-list@redhat.com</contact>
|
||||
<bugs>#3958</bugs>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="2.0">
|
||||
<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="2.0">
|
||||
<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="100%" target="2.0">
|
||||
<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>
|
||||
|
||||
<section>
|
||||
<title>Internationalization</title>
|
||||
|
||||
<entry size="big" status="90%" target="2.0">
|
||||
<entry size="big" status="0%" target="1.4">
|
||||
<title>Integrate Pango</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -136,7 +90,7 @@
|
||||
<contact>gtk-i18n-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="90%" target="2.0">
|
||||
<entry size="medium" status="20%" target="1.4">
|
||||
<title>Switch to using UTF-8</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -158,11 +112,11 @@
|
||||
<contact>gtk-i18n-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="60%" target="2.0">
|
||||
<entry size="big" status="0%" target="1.4">
|
||||
<title>Rewrite Input Method Support</title>
|
||||
<description>
|
||||
<p>
|
||||
Support for Input Methods is GTK+-1.2 is done via XIM, with
|
||||
Current support for Input Methods 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
|
||||
@@ -172,19 +126,18 @@
|
||||
set of callbacks that are invoked by the input methods.
|
||||
</p>
|
||||
<p>
|
||||
GTK+-2.0 will have a new system with loadable input method
|
||||
modules. These modules can either be implemented using XIM,
|
||||
or written from scratch.
|
||||
While adding the above support, it may be desirable to
|
||||
generalize the input-method support to the point where
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-i18n-list@redhat.com</contact>
|
||||
</entry>
|
||||
</section> <!-- i18n -->
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>GTK+ Core</title>
|
||||
|
||||
<entry size="big" status="60%" target="2.0">
|
||||
<entry size="big" status="5%" target="1.4">
|
||||
<title>GLib based object and type system</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -197,7 +150,7 @@
|
||||
<contact>Tim Janik <timj@gtk.org></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="1%" target="2.0">
|
||||
<entry size="big" status="1%" target="1.4">
|
||||
<title>Overall callback improvements</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -210,10 +163,10 @@
|
||||
"GLib based object and type system").
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
<contact>gtk-devel-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="0%" target="2.0">
|
||||
<entry size="big" status="0%" target="1.4">
|
||||
<title>State change notification</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -233,7 +186,7 @@
|
||||
<contact>Tim Janik <timj@gtk.org></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="5%" target="2.0">
|
||||
<entry size="big" status="5%" target="1.4">
|
||||
<title>Widget as sensitivity/grab state machine</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -253,7 +206,7 @@
|
||||
<contact>Tim Janik <timj@gtk.org></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="0%" target="2.0">
|
||||
<entry size="big" status="0%" target="1.4">
|
||||
<title>Allow argument customization</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -269,7 +222,7 @@
|
||||
</description>
|
||||
</entry>
|
||||
|
||||
<entry size="medium" status="0%" target="2.0">
|
||||
<entry size="medium" status="0%" target="1.4">
|
||||
<title>Allow global customization</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -286,7 +239,7 @@
|
||||
</description>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="2.0">
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Gtk+ Modules installation directory</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -297,100 +250,15 @@
|
||||
code (especially on AIX).
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
<contact>gtk-devel-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
|
||||
<entry size="small" status="20%" target="2.0">
|
||||
<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="> 2.0">
|
||||
<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="80%" target="2.0">
|
||||
<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="> 2.0">
|
||||
<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="> 2.0">
|
||||
<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 2.0). A more difficult, probably
|
||||
a post-2.0 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="2.0">
|
||||
<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>
|
||||
|
||||
<section>
|
||||
<title>GTK+ Widgets</title>
|
||||
|
||||
<entry size="small" status="100%" target="2.0">
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Make GtkFrame use a label</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -402,31 +270,31 @@
|
||||
in that slot.)
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
<contact>gtk-devel-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="90%" target="2.0">
|
||||
<entry size="big" status="50%" 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.
|
||||
The GtkText widget is badly in need of replacement, since it is
|
||||
buggy and insufficiently feature rich. There are a number
|
||||
of possible candidates for a replacement, with the most
|
||||
promising at the current time being Havoc Pennington's
|
||||
(hp@redhat.com) 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.
|
||||
As part of this job it will be necessary to add
|
||||
<a href="http://www.pango.org">Pango</a> support to the
|
||||
replacement. The structure of the Tk text widget port seems
|
||||
suited to this as it works paragraph-by-paragraph, and
|
||||
Pango works at a sub-paragraph scale.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
<contact>gtk-devel-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="20%" target="2.0">
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Improve Radio/Checkbutton Look</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -438,10 +306,10 @@
|
||||
will fit in with well with the rest of the GTK+ look.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
<contact>gtk-devel-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="99%" target="2.0">
|
||||
<entry size="small" status="0%" target="1.4">
|
||||
<title>Improve Submenu Navigation</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -454,10 +322,10 @@
|
||||
side of the submenu.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
<contact>gtk-devel-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="2.0 ?">
|
||||
<entry size="small" status="0%" target="1.4 ?">
|
||||
<title>Improve Spinbutton Look</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -475,23 +343,23 @@
|
||||
windowing systems.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
<contact>gtk-devel-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="90%" target="2.0">
|
||||
<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 2.0
|
||||
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="2.0">
|
||||
<entry size="medium" status="90%" target="1.4">
|
||||
<title>Improved generic combo support</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -504,7 +372,7 @@
|
||||
<contact>Tim Janik <timj@gtk.org></contact>
|
||||
</entry>
|
||||
|
||||
<entry size="big" status="40%" target="2.0?">
|
||||
<entry size="big" status="0%" target="> 1.4">
|
||||
<title>Add unified set of List/Tree/Grid widgets</title>
|
||||
<description>
|
||||
<p>
|
||||
@@ -526,214 +394,7 @@
|
||||
both the simplicity and power of the interfaces.
|
||||
</p>
|
||||
</description>
|
||||
<contact>gtk-devel-list@gnome.org</contact>
|
||||
<contact>gtk-devel-list@redhat.com</contact>
|
||||
</entry>
|
||||
|
||||
<entry size="small" status="0%" target="2.0">
|
||||
<title>GtkImage</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="2.0">
|
||||
<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="2.0">
|
||||
<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="2.0">
|
||||
<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="> 2.0">
|
||||
<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="> 2.0">
|
||||
<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="> 2.0">
|
||||
<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="> 2.0">
|
||||
<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="57%" target="2.0">
|
||||
<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="20%" target="2.0">
|
||||
<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="2.0">
|
||||
<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="2.0">
|
||||
<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="100%" target="2.0">
|
||||
<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="70%" target="2.0">
|
||||
<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="2.0">
|
||||
<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="2.0">
|
||||
<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+ -->
|
||||
</section>
|
||||
</todo>
|
||||
|
||||
|
12
acconfig.h
@@ -19,11 +19,11 @@
|
||||
#undef GTK_COMPILED_WITH_DEBUGGING
|
||||
|
||||
#undef HAVE_CATGETS
|
||||
#undef HAVE_DIMM_H
|
||||
#undef HAVE_DIRENT_H
|
||||
#undef HAVE_GETTEXT
|
||||
#undef HAVE_IPC_H
|
||||
#undef HAVE_LC_MESSAGES
|
||||
#undef HAVE_PROGRESSIVE_JPEG
|
||||
#undef HAVE_PWD_H
|
||||
#undef HAVE_SHM_H
|
||||
#undef HAVE_STPCPY
|
||||
@@ -31,21 +31,16 @@
|
||||
#undef HAVE_SHAPE_EXT
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
#undef HAVE_SYS_TIME_H
|
||||
#undef HAVE_WINTAB_H
|
||||
#undef HAVE_XCONVERTCASE
|
||||
|
||||
#undef NO_FD_SET
|
||||
|
||||
#undef RESOURCE_BASE
|
||||
|
||||
#undef USE_GMODULE
|
||||
#undef USE_MMX
|
||||
|
||||
/* Define to use X11R6 additions to XIM */
|
||||
#undef USE_X11R6_XIM
|
||||
|
||||
/* Define to use XKB extension */
|
||||
#undef HAVE_XKB
|
||||
|
||||
#undef XINPUT_NONE
|
||||
#undef XINPUT_GXI
|
||||
#undef XINPUT_XFREE
|
||||
@@ -56,7 +51,8 @@
|
||||
/* Most machines will be happy with int or void. IRIX requires '...' */
|
||||
#undef SIGNAL_ARG_TYPE
|
||||
|
||||
#undef GETTEXT_PACKAGE
|
||||
/* Define to support OLE2 DND */
|
||||
#undef USE_OLE2_DND
|
||||
|
||||
/* #undef PACKAGE */
|
||||
/* #undef VERSION */
|
||||
|
517
acinclude.m4
@@ -1,433 +1,16 @@
|
||||
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
|
||||
## Copyright (C) 1996-1999 Free Software Foundation, Inc.
|
||||
## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
##
|
||||
## 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## As a special exception to the GNU General Public License, if you
|
||||
## distribute this file as part of a program that contains a
|
||||
## configuration script generated by Autoconf, you may include it under
|
||||
## the same distribution terms that you use for the rest of that program.
|
||||
# autoconf 2.13 / 2.50 compatibility macro
|
||||
|
||||
# serial 40 AC_PROG_LIBTOOL
|
||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
# GLIB_AC_DIVERT_BEFORE_HELP(STUFF)
|
||||
# ---------------------------------
|
||||
# Put STUFF early enough so that they are available for $ac_help expansion.
|
||||
# Handle both classic (<= v2.13) and modern autoconf
|
||||
AC_DEFUN([GLIB_AC_DIVERT_BEFORE_HELP],
|
||||
[ifdef([m4_divert_text], [m4_divert_text([NOTICE],[$1])],
|
||||
[ifdef([AC_DIVERT], [AC_DIVERT([NOTICE],[$1])],
|
||||
[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
|
||||
$1
|
||||
AC_DIVERT_POP()])])])
|
||||
|
||||
# Save cache, so that ltconfig can load it
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
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 $lt_target \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
AC_CACHE_LOAD
|
||||
|
||||
# This can be used to rebuild libtool when needed
|
||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
||||
[AC_PREREQ(2.13)dnl
|
||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_LD])dnl
|
||||
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"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
||||
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 "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
case "`/usr/bin/file conftest.o`" in
|
||||
*32-bit*)
|
||||
LD="${LD-ld} -32"
|
||||
;;
|
||||
*N32*)
|
||||
LD="${LD-ld} -n32"
|
||||
;;
|
||||
*64-bit*)
|
||||
LD="${LD-ld} -64"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -rf conftest*
|
||||
;;
|
||||
|
||||
*-*-sco3.2v5*)
|
||||
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -belf"
|
||||
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
|
||||
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
|
||||
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
|
||||
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
;;
|
||||
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[*-*-cygwin* | *-*-mingw*)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
])
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
||||
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_SHARED, [dnl
|
||||
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
no) enable_shared=no ;;
|
||||
*)
|
||||
enable_shared=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_shared=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_SHARED(no)])
|
||||
|
||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_STATIC, [dnl
|
||||
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
no) enable_static=no ;;
|
||||
*)
|
||||
enable_static=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_static=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_STATIC(no)])
|
||||
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
|
||||
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(fast-install,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_FAST_INSTALL(no)])
|
||||
|
||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AC_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
ac_prog=ld
|
||||
if test "$ac_cv_prog_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
AC_MSG_CHECKING([for ld used by GCC])
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
[\\/]* | [A-Za-z]:[\\/]*)
|
||||
re_direlt='/[^/][^/]*/\.\./'
|
||||
changequote([,])dnl
|
||||
# Canonicalize the path of ld
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
# If it is relative, then search for the first ld in PATH.
|
||||
with_gnu_ld=unknown
|
||||
;;
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
AC_MSG_CHECKING([for GNU ld])
|
||||
else
|
||||
AC_MSG_CHECKING([for non-GNU ld])
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
# Break only if it was the GNU/non-GNU ld that we prefer.
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
else
|
||||
ac_cv_path_LD="$LD" # Let the user override the test with a path.
|
||||
fi])
|
||||
LD="$ac_cv_path_LD"
|
||||
if test -n "$LD"; then
|
||||
AC_MSG_RESULT($LD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
ac_cv_prog_gnu_ld=yes
|
||||
else
|
||||
ac_cv_prog_gnu_ld=no
|
||||
fi])
|
||||
])
|
||||
|
||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AC_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
ac_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
break
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
break
|
||||
else
|
||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
||||
continue # so that we can try to find one that supports BSD flags
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
])
|
||||
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN(AC_CHECK_LIBM,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
LIBM=
|
||||
case "$lt_target" in
|
||||
*-*-beos* | *-*-cygwin*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
*-ncr-sysv4.3*)
|
||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl convenience library, adds --enable-ltdl-convenience to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
case "$enable_ltdl_convenience" in
|
||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
||||
"") enable_ltdl_convenience=yes
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
||||
esac
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
])
|
||||
|
||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl installable library, and adds --enable-ltdl-install to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_CHECK_LIB(ltdl, main,
|
||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
||||
[if test x"$enable_ltdl_install" = xno; then
|
||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
||||
else
|
||||
enable_ltdl_install=yes
|
||||
fi
|
||||
])
|
||||
if test x"$enable_ltdl_install" = x"yes"; then
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
else
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
||||
LIBLTDL="-lltdl"
|
||||
INCLTDL=
|
||||
fi
|
||||
])
|
||||
|
||||
dnl old names
|
||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
||||
|
||||
dnl This is just to silence aclocal about the macro not being used
|
||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
||||
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
@@ -766,3 +349,81 @@ strdup __argz_count __argz_stringify __argz_next])
|
||||
< $srcdir/po/POTFILES.in > po/POTFILES
|
||||
])
|
||||
|
||||
|
||||
# Search path for a program which passes the given test.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU General Public
|
||||
# License or the GNU Library General Public License but which still want
|
||||
# to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code of the GNU gettext library is covered
|
||||
# by the GNU Library General Public License, and the rest of the GNU
|
||||
# gettext package package is covered by the GNU General Public License.
|
||||
# They are *not* in the public domain.
|
||||
|
||||
# serial 2
|
||||
|
||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
|
||||
[# Extract the first word of "$2", so it can be a program name with args.
|
||||
set dummy $2; ac_word=[$]2
|
||||
AC_MSG_CHECKING([for $ac_word])
|
||||
AC_CACHE_VAL(ac_cv_path_$1,
|
||||
[case "[$]$1" in
|
||||
/*)
|
||||
ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in ifelse([$5], , $PATH, [$5]); do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/$ac_word; then
|
||||
if [$3]; then
|
||||
ac_cv_path_$1="$ac_dir/$ac_word"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
dnl If no 4th arg is given, leave the cache variable unset,
|
||||
dnl so AC_PATH_PROGS will keep looking.
|
||||
ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||
])dnl
|
||||
;;
|
||||
esac])dnl
|
||||
$1="$ac_cv_path_$1"
|
||||
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
|
||||
AC_MSG_RESULT([$]$1)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
# Check whether LC_MESSAGES is available in <locale.h>.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
#
|
||||
# This file can be copied and used freely without restrictions. It can
|
||||
# be used in projects which are not available under the GNU General Public
|
||||
# License or the GNU Library General Public License but which still want
|
||||
# to provide support for the GNU gettext functionality.
|
||||
# Please note that the actual code of the GNU gettext library is covered
|
||||
# by the GNU Library General Public License, and the rest of the GNU
|
||||
# gettext package package is covered by the GNU General Public License.
|
||||
# They are *not* in the public domain.
|
||||
|
||||
# serial 2
|
||||
|
||||
AC_DEFUN([AM_LC_MESSAGES],
|
||||
[if test $ac_cv_header_locale_h = yes; then
|
||||
AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
|
||||
[AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
|
||||
am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
|
||||
if test $am_cv_val_LC_MESSAGES = yes; then
|
||||
AC_DEFINE(HAVE_LC_MESSAGES, 1,
|
||||
[Define if your <locale.h> file defines LC_MESSAGES.])
|
||||
fi
|
||||
fi])
|
||||
|
||||
|
12
autogen.sh
@@ -49,7 +49,7 @@ esac
|
||||
if test -z "$ACLOCAL_FLAGS"; then
|
||||
|
||||
acdir=`aclocal --print-ac-dir`
|
||||
m4list="glib-2.0.m4 gettext.m4"
|
||||
m4list="glib-2.0.m4 glib-gettext.m4"
|
||||
|
||||
for file in $m4list
|
||||
do
|
||||
@@ -65,17 +65,11 @@ if test -z "$ACLOCAL_FLAGS"; then
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Running gettextize... Ignore non-fatal messages."
|
||||
echo "Running glib-gettextize... Ignore non-fatal messages."
|
||||
# Hmm, we specify --force here, since otherwise things dont'
|
||||
# get added reliably, but we don't want to overwrite intl
|
||||
# while making dist.
|
||||
echo "no" | gettextize --copy --force
|
||||
|
||||
#
|
||||
# Really bad hack
|
||||
echo "Munging po/Makefile.in.in"
|
||||
sed s%@PACKAGE@%@GETTEXT_PACKAGE@% < po/Makefile.in.in > po/Makefile.in.in.new
|
||||
mv po/Makefile.in.in.new po/Makefile.in.in
|
||||
echo "no" | glib-gettextize --copy --force
|
||||
|
||||
aclocal $ACLOCAL_FLAGS
|
||||
|
||||
|
@@ -14,19 +14,6 @@
|
||||
This function is required for alloca.c support on those systems. */
|
||||
/* #undef CRAY_STACKSEG_END */
|
||||
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#define HAVE_ALLOCA 1
|
||||
#ifndef alloca
|
||||
#ifdef _MSC_VER
|
||||
#define alloca _alloca
|
||||
#elif defined (__GNUC__)
|
||||
#define alloca __builtin_alloca
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
/* #undef HAVE_ALLOCA_H */
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
/* #undef HAVE_MMAP */
|
||||
|
||||
@@ -62,7 +49,7 @@
|
||||
#define GTK_COMPILED_WITH_DEBUGGING "minimum"
|
||||
|
||||
/* #undef HAVE_CATGETS */
|
||||
/* #undef HAVE_DIRENT_H */
|
||||
#define HAVE_DIRENT_H 1
|
||||
#define HAVE_GETTEXT 1
|
||||
/* #undef HAVE_IPC_H */
|
||||
/* #undef HAVE_LC_MESSAGES */
|
||||
@@ -186,16 +173,9 @@
|
||||
/* #undef WITH_SYMBOL_UNDERSCORE */
|
||||
|
||||
/* Define if you have the Wintab programmer's kit */
|
||||
#define HAVE_WINTAB 1
|
||||
#define HAVE_WINTAB_H 1
|
||||
|
||||
/* Define if you have the <dimm.h> header file
|
||||
* (available in the Platform SDK)
|
||||
* (available from http://msdn.microsoft.com/downloads/samples/internet/wizard/)
|
||||
*/
|
||||
/* #define HAVE_DIMM_H 1 */
|
||||
|
||||
#define USE_GMODULE 1
|
||||
#define USE_MMX 1
|
||||
|
||||
/* #undef HAVE_SIGSETJMP */
|
||||
|
||||
#define GETTEXT_PACKAGE "gtk20"
|
||||
|
885
configure.in
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
@@ -1,8 +0,0 @@
|
||||
|
||||
if USE_X11
|
||||
XDIRS=gdk-pixbuf-xlib
|
||||
else
|
||||
XDIRS=
|
||||
endif
|
||||
|
||||
SUBDIRS=$(XDIRS)
|
@@ -1,7 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.la
|
||||
*.lo
|
||||
.libs
|
||||
.deps
|
||||
gdk-pixbuf-xlib-2.0.pc
|
@@ -1,53 +0,0 @@
|
||||
2000-10-06 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gdk-pixbuf-xlib.c: Put display/screen here, instead of in
|
||||
the main gdk-pixbuf library as it was in 1.0; since the io-xpm
|
||||
loader doesn't use these variables anymore it should be OK
|
||||
|
||||
2000-09-26 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-xlib-drawable.c
|
||||
(gdk_pixbuf_xlib_get_from_drawable): Do not use
|
||||
gdk_screen_{width,height}(). Thanks to John Harper for pointing
|
||||
this out.
|
||||
|
||||
2000-08-26 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-xlibrgb.c: Added API reference docs.
|
||||
|
||||
2000-08-25 Federico Mena Quintero <federico@helixcode.com>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-xlib-drawable.c (handle_x_error): Return
|
||||
0.
|
||||
(xlib_window_is_viewable): Return FALSE in the last case.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-xlib-render.c: Updated the inline docs.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-xlib.c: Added API docs.
|
||||
|
||||
2000-08-25 John Harper <john@dcs.warwick.ac.uk>
|
||||
|
||||
Work to create an Xlib version of gdk-pixbuf (with the Xlib
|
||||
port of GdkRGB for rendering):
|
||||
|
||||
* configure.in: check for X libraries, set and substitute
|
||||
GDK_PIXBUF_XLIB_{LIBDIR,INCLUDEDIR,LIBS} variables
|
||||
|
||||
* gdk_pixbuf_xlibConf.sh.in: new file -- gnome-config details
|
||||
for the gdk-pixbuf-xlib library
|
||||
* Makefile.am: build and install gdk_pixbuf_xlibConf.sh
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-xlib-render.c,
|
||||
gdk-pixbuf/gdk-pixbuf-xlib.c, gdk-pixbuf/gdk-pixbuf-xlib.h,
|
||||
gdk-pixbuf/gdk-pixbuf-xlib-private.h,
|
||||
gdk-pixbuf/gdk-pixbuf-xlib-drawable.c: new files, ported the
|
||||
GDK dependent parts of gdk-pixbuf to use Xlib. Functions that
|
||||
were called gdk_pixbuf_FOO are now gdk_pixbuf_xlib_FOO
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-xlibrgb.c,
|
||||
gdk-pixbuf/gdk-pixbuf-xlibrgb.h: added Chris Blizzard's Xlib
|
||||
port of GdkRGB (from Mozilla CVS)
|
||||
|
||||
* gdk-pixbuf/Makefile.am: build a library libgdk_pixbuf_xlib.la
|
||||
including the non-GDK dependent objects from libgdk_pixbuf.la
|
||||
plus the Xlib ports and xlibrgb
|
@@ -1,32 +0,0 @@
|
||||
|
||||
lib_LTLIBRARIES=libgdk_pixbuf_xlib-1.3.la
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
|
||||
-I$(top_srcdir)/gdk-pixbuf \
|
||||
-I$(top_srcdir)/contrib \
|
||||
$(GLIB_CFLAGS)
|
||||
|
||||
LDADDS = @STRIP_BEGIN@ \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
@GLIB_LIBS@ \
|
||||
-lm \
|
||||
@STRIP_END@
|
||||
|
||||
libgdk_pixbuf_xlib_1_3_la_LDFLAGS = \
|
||||
-export-dynamic
|
||||
|
||||
libgdk_pixbuf_xlib_1_3_la_SOURCES = \
|
||||
gdk-pixbuf-xlib-private.h \
|
||||
gdk-pixbuf-xlib.c \
|
||||
gdk-pixbuf-xlib-render.c \
|
||||
gdk-pixbuf-xlib-drawable.c \
|
||||
gdk-pixbuf-xlibrgb.c
|
||||
|
||||
libgdk_pixbuf_xlibincludedir=$(includedir)/gtk-2.0/gdk-pixbuf-xlib
|
||||
|
||||
libgdk_pixbuf_xlibinclude_HEADERS = \
|
||||
gdk-pixbuf-xlib.h \
|
||||
gdk-pixbuf-xlibrgb.h
|
||||
|
||||
|
@@ -1,11 +0,0 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: GdkPixbufXlib
|
||||
Description: Image loading and scaling for Xlib
|
||||
Version: @VERSION@
|
||||
Requires: gobject-2.0,gmodule-2.0,gdk-pixbuf-2.0
|
||||
Libs: -L${libdir} -lgdk_pixbuf_xlib-1.3
|
||||
Cflags: -I${includedir}
|
@@ -1,30 +0,0 @@
|
||||
/* GdkPixbuf library - Xlib header file
|
||||
*
|
||||
* Authors: John Harper <john@dcs.warwick.ac.uk>
|
||||
*
|
||||
* 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_XLIB_PRIVATE_H
|
||||
#define GDK_PIXBUF_XLIB_PRIVATE_H
|
||||
|
||||
#include "gdk-pixbuf-xlib.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
extern Display *gdk_pixbuf_dpy;
|
||||
extern int gdk_pixbuf_screen;
|
||||
|
||||
#endif
|
@@ -1,398 +0,0 @@
|
||||
/* GdkPixbuf library - Rendering functions
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Author: Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* Trivially ported to Xlib(RGB) by John Harper. */
|
||||
|
||||
#include <config.h>
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdk-pixbuf-xlib-private.h"
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_xlib_render_threshold_alpha:
|
||||
* @pixbuf: A pixbuf.
|
||||
* @bitmap: Bitmap where the bilevel mask will be painted to.
|
||||
* @src_x: Source X coordinate.
|
||||
* @src_y: source Y coordinate.
|
||||
* @dest_x: Destination X coordinate.
|
||||
* @dest_y: Destination Y coordinate.
|
||||
* @width: Width of region to threshold.
|
||||
* @height: Height of region to threshold.
|
||||
* @alpha_threshold: Opacity values below this will be painted as zero; all
|
||||
* other values will be painted as one.
|
||||
*
|
||||
* Takes the opacity values in a rectangular portion of a pixbuf and thresholds
|
||||
* them to produce a bi-level alpha mask that can be used as a clipping mask for
|
||||
* a drawable.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_xlib_render_threshold_alpha (GdkPixbuf *pixbuf, Pixmap bitmap,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height,
|
||||
int alpha_threshold)
|
||||
{
|
||||
GC gc;
|
||||
XColor color;
|
||||
int x, y;
|
||||
guchar *p;
|
||||
int start, start_status;
|
||||
int status;
|
||||
XGCValues gcv;
|
||||
|
||||
g_return_if_fail (pixbuf != NULL);
|
||||
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);
|
||||
|
||||
g_return_if_fail (bitmap != 0);
|
||||
g_return_if_fail (width >= 0 && height >= 0);
|
||||
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
|
||||
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
|
||||
|
||||
g_return_if_fail (alpha_threshold >= 0 && alpha_threshold <= 255);
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
return;
|
||||
|
||||
gc = XCreateGC (gdk_pixbuf_dpy, bitmap, 0, &gcv);
|
||||
|
||||
if (!pixbuf->has_alpha) {
|
||||
color.pixel = (alpha_threshold == 255) ? 0 : 1;
|
||||
XSetForeground (gdk_pixbuf_dpy, gc, color.pixel);
|
||||
XFillRectangle (gdk_pixbuf_dpy, bitmap, gc,
|
||||
dest_x, dest_y, width, height);
|
||||
XFreeGC (gdk_pixbuf_dpy, gc);
|
||||
return;
|
||||
}
|
||||
|
||||
color.pixel = 0;
|
||||
XSetForeground (gdk_pixbuf_dpy, gc, color.pixel);
|
||||
XFillRectangle (gdk_pixbuf_dpy, bitmap, gc,
|
||||
dest_x, dest_y, width, height);
|
||||
|
||||
color.pixel = 1;
|
||||
XSetForeground (gdk_pixbuf_dpy, gc, color.pixel);
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
p = (pixbuf->pixels + (y + src_y) * pixbuf->rowstride + src_x * pixbuf->n_channels
|
||||
+ pixbuf->n_channels - 1);
|
||||
|
||||
start = 0;
|
||||
start_status = *p < alpha_threshold;
|
||||
|
||||
for (x = 0; x < width; x++) {
|
||||
status = *p < alpha_threshold;
|
||||
|
||||
if (status != start_status) {
|
||||
if (!start_status)
|
||||
XDrawLine (gdk_pixbuf_dpy, bitmap, gc,
|
||||
start + dest_x, y + dest_y,
|
||||
x - 1 + dest_x, y + dest_y);
|
||||
|
||||
start = x;
|
||||
start_status = status;
|
||||
}
|
||||
|
||||
p += pixbuf->n_channels;
|
||||
}
|
||||
|
||||
if (!start_status)
|
||||
XDrawLine (gdk_pixbuf_dpy, bitmap, gc,
|
||||
start + dest_x, y + dest_y,
|
||||
x - 1 + dest_x, y + dest_y);
|
||||
}
|
||||
|
||||
XFreeGC (gdk_pixbuf_dpy, gc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Creates a buffer by stripping the alpha channel of a pixbuf */
|
||||
static guchar *
|
||||
remove_alpha (GdkPixbuf *pixbuf, int x, int y, int width, int height, int *rowstride)
|
||||
{
|
||||
guchar *buf;
|
||||
int xx, yy;
|
||||
guchar *src, *dest;
|
||||
|
||||
g_assert (pixbuf->n_channels == 4);
|
||||
g_assert (pixbuf->has_alpha);
|
||||
g_assert (width > 0 && height > 0);
|
||||
g_assert (x >= 0 && x + width <= pixbuf->width);
|
||||
g_assert (y >= 0 && y + height <= pixbuf->height);
|
||||
|
||||
*rowstride = 4 * ((width * 3 + 3) / 4);
|
||||
|
||||
buf = g_new (guchar, *rowstride * height);
|
||||
|
||||
for (yy = 0; yy < height; yy++) {
|
||||
src = pixbuf->pixels + pixbuf->rowstride * (yy + y) + x * pixbuf->n_channels;
|
||||
dest = buf + *rowstride * yy;
|
||||
|
||||
for (xx = 0; xx < width; xx++) {
|
||||
*dest++ = *src++;
|
||||
*dest++ = *src++;
|
||||
*dest++ = *src++;
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_xlib_render_to_drawable:
|
||||
* @pixbuf: A pixbuf.
|
||||
* @drawable: Destination drawable.
|
||||
* @gc: GC used for rendering.
|
||||
* @src_x: Source X coordinate within pixbuf.
|
||||
* @src_y: Source Y coordinate within pixbuf.
|
||||
* @dest_x: Destination X coordinate within drawable.
|
||||
* @dest_y: Destination Y coordinate within drawable.
|
||||
* @width: Width of region to render, in pixels.
|
||||
* @height: Height of region to render, in pixels.
|
||||
* @dither: Dithering mode for XlibRGB.
|
||||
* @x_dither: X offset for dither.
|
||||
* @y_dither: Y offset for dither.
|
||||
*
|
||||
* Renders a rectangular portion of a pixbuf to a drawable while using the
|
||||
* specified GC. This is done using XlibRGB, so the specified drawable must
|
||||
* have the XlibRGB visual and colormap. Note that this function will ignore
|
||||
* the opacity information for images with an alpha channel; the GC must already
|
||||
* have the clipping mask set if you want transparent regions to show through.
|
||||
*
|
||||
* For an explanation of dither offsets, see the XlibRGB documentation. In
|
||||
* brief, the dither offset is important when re-rendering partial regions of an
|
||||
* image to a rendered version of the full image, or for when the offsets to a
|
||||
* base position change, as in scrolling. The dither matrix has to be shifted
|
||||
* for consistent visual results. If you do not have any of these cases, the
|
||||
* dither offsets can be both zero.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_xlib_render_to_drawable (GdkPixbuf *pixbuf,
|
||||
Drawable drawable, GC gc,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height,
|
||||
XlibRgbDither dither,
|
||||
int x_dither, int y_dither)
|
||||
{
|
||||
guchar *buf;
|
||||
int rowstride;
|
||||
|
||||
g_return_if_fail (pixbuf != NULL);
|
||||
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);
|
||||
|
||||
g_return_if_fail (drawable != 0);
|
||||
g_return_if_fail (gc != 0);
|
||||
|
||||
g_return_if_fail (width >= 0 && height >= 0);
|
||||
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
|
||||
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
return;
|
||||
|
||||
/* This will have to be modified once we support other image types.
|
||||
* Also, GdkRGB does not have gdk_draw_rgb_32_image_dithalign(), so we
|
||||
* have to pack the buffer first. Sigh.
|
||||
*/
|
||||
|
||||
if (pixbuf->has_alpha)
|
||||
buf = remove_alpha (pixbuf, src_x, src_y, width, height, &rowstride);
|
||||
else {
|
||||
buf = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 3;
|
||||
rowstride = pixbuf->rowstride;
|
||||
}
|
||||
|
||||
xlib_draw_rgb_image_dithalign (drawable, gc,
|
||||
dest_x, dest_y,
|
||||
width, height,
|
||||
dither,
|
||||
buf, rowstride,
|
||||
x_dither, y_dither);
|
||||
|
||||
if (pixbuf->has_alpha)
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_xlib_render_to_drawable_alpha:
|
||||
* @pixbuf: A pixbuf.
|
||||
* @drawable: Destination drawable.
|
||||
* @src_x: Source X coordinate within pixbuf.
|
||||
* @src_y: Source Y coordinates within pixbuf.
|
||||
* @dest_x: Destination X coordinate within drawable.
|
||||
* @dest_y: Destination Y coordinate within drawable.
|
||||
* @width: Width of region to render, in pixels.
|
||||
* @height: Height of region to render, in pixels.
|
||||
* @alpha_mode: If the image does not have opacity information, this is ignored.
|
||||
* Otherwise, specifies how to handle transparency when rendering.
|
||||
* @alpha_threshold: If the image does have opacity information and @alpha_mode
|
||||
* is GDK_PIXBUF_ALPHA_BILEVEL, specifies the threshold value for opacity
|
||||
* values.
|
||||
* @dither: Dithering mode for XlibRGB.
|
||||
* @x_dither: X offset for dither.
|
||||
* @y_dither: Y offset for dither.
|
||||
*
|
||||
* Renders a rectangular portion of a pixbuf to a drawable. This is done using
|
||||
* XlibRGB, so the specified drawable must have the XlibRGB visual and colormap.
|
||||
*
|
||||
* When used with #GDK_PIXBUF_ALPHA_BILEVEL, this function has to create a bitmap
|
||||
* out of the thresholded alpha channel of the image and, it has to set this
|
||||
* bitmap as the clipping mask for the GC used for drawing. This can be a
|
||||
* significant performance penalty depending on the size and the complexity of
|
||||
* the alpha channel of the image. If performance is crucial, consider handling
|
||||
* the alpha channel yourself (possibly by caching it in your application) and
|
||||
* using gdk_pixbuf_xlib_render_to_drawable() or GdkRGB directly instead.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_xlib_render_to_drawable_alpha (GdkPixbuf *pixbuf, Drawable drawable,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height,
|
||||
GdkPixbufAlphaMode alpha_mode,
|
||||
int alpha_threshold,
|
||||
XlibRgbDither dither,
|
||||
int x_dither, int y_dither)
|
||||
{
|
||||
Pixmap bitmap = 0;
|
||||
GC gc;
|
||||
XGCValues gcv;
|
||||
|
||||
g_return_if_fail (pixbuf != NULL);
|
||||
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);
|
||||
|
||||
g_return_if_fail (drawable != 0);
|
||||
g_return_if_fail (width >= 0 && height >= 0);
|
||||
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
|
||||
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
return;
|
||||
|
||||
gc = XCreateGC (gdk_pixbuf_dpy, drawable, 0, &gcv);
|
||||
|
||||
if (pixbuf->has_alpha) {
|
||||
/* Right now we only support GDK_PIXBUF_ALPHA_BILEVEL, so we
|
||||
* unconditionally create the clipping mask.
|
||||
*/
|
||||
|
||||
bitmap = XCreatePixmap (gdk_pixbuf_dpy,
|
||||
RootWindow (gdk_pixbuf_dpy,
|
||||
gdk_pixbuf_screen),
|
||||
width, height, 1);
|
||||
gdk_pixbuf_xlib_render_threshold_alpha (pixbuf, bitmap,
|
||||
src_x, src_y,
|
||||
0, 0,
|
||||
width, height,
|
||||
alpha_threshold);
|
||||
|
||||
XSetClipMask (gdk_pixbuf_dpy, gc, bitmap);
|
||||
XSetClipOrigin (gdk_pixbuf_dpy, gc, dest_x, dest_y);
|
||||
}
|
||||
|
||||
gdk_pixbuf_xlib_render_to_drawable (pixbuf, drawable, gc,
|
||||
src_x, src_y,
|
||||
dest_x, dest_y,
|
||||
width, height,
|
||||
dither,
|
||||
x_dither, y_dither);
|
||||
|
||||
if (bitmap)
|
||||
XFreePixmap (gdk_pixbuf_dpy, bitmap);
|
||||
|
||||
XFreeGC (gdk_pixbuf_dpy, gc);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_xlib_render_pixmap_and_mask:
|
||||
* @pixbuf: A pixbuf.
|
||||
* @pixmap_return: Return value for the created pixmap.
|
||||
* @mask_return: Return value for the created mask.
|
||||
* @alpha_threshold: Threshold value for opacity values.
|
||||
*
|
||||
* Creates a pixmap and a mask bitmap which are returned in the @pixmap_return
|
||||
* and @mask_return arguments, respectively, and renders a pixbuf and its
|
||||
* corresponding tresholded alpha mask to them. This is merely a convenience
|
||||
* function; applications that need to render pixbufs with dither offsets or to
|
||||
* given drawables should use gdk_pixbuf_xlib_render_to_drawable_alpha() or
|
||||
* gdk_pixbuf_xlib_render_to_drawable(), and
|
||||
* gdk_pixbuf_xlib_render_threshold_alpha().
|
||||
*
|
||||
* If the pixbuf does not have an alpha channel, then *@mask_return will be set
|
||||
* to None.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_xlib_render_pixmap_and_mask (GdkPixbuf *pixbuf,
|
||||
Pixmap *pixmap_return,
|
||||
Pixmap *mask_return,
|
||||
int alpha_threshold)
|
||||
{
|
||||
g_return_if_fail (pixbuf != NULL);
|
||||
|
||||
if (pixmap_return) {
|
||||
GC gc;
|
||||
XGCValues gcv;
|
||||
|
||||
*pixmap_return = XCreatePixmap (gdk_pixbuf_dpy,
|
||||
RootWindow (gdk_pixbuf_dpy,
|
||||
gdk_pixbuf_screen),
|
||||
pixbuf->width,
|
||||
pixbuf->height,
|
||||
xlib_rgb_get_depth ());
|
||||
gc = XCreateGC (gdk_pixbuf_dpy, *pixmap_return, 0, &gcv);
|
||||
gdk_pixbuf_xlib_render_to_drawable (pixbuf, *pixmap_return, gc,
|
||||
0, 0, 0, 0,
|
||||
pixbuf->width,
|
||||
pixbuf->height,
|
||||
XLIB_RGB_DITHER_NORMAL,
|
||||
0, 0);
|
||||
XFreeGC (gdk_pixbuf_dpy, gc);
|
||||
}
|
||||
|
||||
if (mask_return) {
|
||||
if (pixbuf->has_alpha) {
|
||||
*mask_return = XCreatePixmap (gdk_pixbuf_dpy,
|
||||
RootWindow (gdk_pixbuf_dpy,
|
||||
gdk_pixbuf_screen),
|
||||
pixbuf->width,
|
||||
pixbuf->height, 1);
|
||||
gdk_pixbuf_xlib_render_threshold_alpha (pixbuf,
|
||||
*mask_return,
|
||||
0, 0, 0, 0,
|
||||
pixbuf->width,
|
||||
pixbuf->height,
|
||||
alpha_threshold);
|
||||
} else
|
||||
*mask_return = 0;
|
||||
}
|
||||
}
|
@@ -1,63 +0,0 @@
|
||||
/* GdkPixbuf library - Initialization functions
|
||||
*
|
||||
* Author: John Harper <john@dcs.warwick.ac.uk>
|
||||
*
|
||||
* 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 <X11/Xlib.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf-private.h>
|
||||
#include "gdk-pixbuf-xlib-private.h"
|
||||
|
||||
Display *gdk_pixbuf_dpy = NULL;
|
||||
int gdk_pixbuf_screen = -1;
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_xlib_init:
|
||||
* @display: X display to use.
|
||||
* @screen_num: Screen number.
|
||||
*
|
||||
* Initializes the gdk-pixbuf Xlib machinery by calling xlib_rgb_init(). This
|
||||
* function should be called near the beginning of your program, or before using
|
||||
* any of the gdk-pixbuf-xlib functions.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_xlib_init (Display *display, int screen_num)
|
||||
{
|
||||
xlib_rgb_init (display, ScreenOfDisplay (display, screen_num));
|
||||
gdk_pixbuf_dpy = display;
|
||||
gdk_pixbuf_screen = screen_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_xlib_init_with_depth:
|
||||
* @display: X display to use.
|
||||
* @screen_num: Screen number.
|
||||
* @prefDepth: Preferred depth for XlibRGB.
|
||||
*
|
||||
* Similar to gdk_pixbuf_xlib_init(), but also lets you specify the preferred
|
||||
* depth for XlibRGB if you do not want it to use the default depth it picks.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_xlib_init_with_depth (Display *display,
|
||||
int screen_num, int prefDepth)
|
||||
{
|
||||
xlib_rgb_init_with_depth (display, ScreenOfDisplay (display, screen_num),
|
||||
prefDepth);
|
||||
gdk_pixbuf_dpy = display;
|
||||
gdk_pixbuf_screen = screen_num;
|
||||
}
|
@@ -1,82 +0,0 @@
|
||||
/* GdkPixbuf library - Xlib header file
|
||||
*
|
||||
* Authors: John Harper <john@dcs.warwick.ac.uk>
|
||||
*
|
||||
* 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_XLIB_H
|
||||
#define GDK_PIXBUF_XLIB_H
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
|
||||
|
||||
/* init */
|
||||
|
||||
void gdk_pixbuf_xlib_init (Display *display, int screen_num);
|
||||
|
||||
void gdk_pixbuf_xlib_init_with_depth (Display *display, int screen_num,
|
||||
int prefDepth);
|
||||
|
||||
|
||||
|
||||
/* render */
|
||||
|
||||
void gdk_pixbuf_xlib_render_threshold_alpha (GdkPixbuf *pixbuf, Pixmap bitmap,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height,
|
||||
int alpha_threshold);
|
||||
|
||||
void gdk_pixbuf_xlib_render_to_drawable (GdkPixbuf *pixbuf,
|
||||
Drawable drawable, GC gc,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height,
|
||||
XlibRgbDither dither,
|
||||
int x_dither, int y_dither);
|
||||
|
||||
|
||||
void gdk_pixbuf_xlib_render_to_drawable_alpha (GdkPixbuf *pixbuf,
|
||||
Drawable drawable,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height,
|
||||
GdkPixbufAlphaMode alpha_mode,
|
||||
int alpha_threshold,
|
||||
XlibRgbDither dither,
|
||||
int x_dither, int y_dither);
|
||||
|
||||
void gdk_pixbuf_xlib_render_pixmap_and_mask (GdkPixbuf *pixbuf,
|
||||
Pixmap *pixmap_return,
|
||||
Pixmap *mask_return,
|
||||
int alpha_threshold);
|
||||
|
||||
|
||||
|
||||
/* drawable */
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_xlib_get_from_drawable (GdkPixbuf *dest,
|
||||
Drawable src,
|
||||
Colormap cmap, Visual *visual,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height);
|
||||
|
||||
#endif /* GDK_PIXBUF_XLIB_H */
|
@@ -1,195 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "MPL"); you may not use this file except in
|
||||
* compliance with the MPL. You may obtain a copy of the MPL at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the MPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* MPL.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the
|
||||
* terms of the GNU Library General Public License (the "LGPL"), in
|
||||
* which case the provisions of the LGPL are applicable instead of
|
||||
* those above. If you wish to allow use of your version of this file
|
||||
* only under the terms of the LGPL and not to allow others to use
|
||||
* your version of this file under the MPL, indicate your decision by
|
||||
* deleting the provisions above and replace them with the notice and
|
||||
* other provisions required by the LGPL. If you do not delete the
|
||||
* provisions above, a recipient may use your version of this file
|
||||
* under either the MPL or the LGPL.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code is derived from GdkRgb.
|
||||
* For more information on GdkRgb, see http://www.levien.com/gdkrgb/
|
||||
* Raph Levien <raph@acm.org>
|
||||
*/
|
||||
|
||||
/* Ported by Christopher Blizzard to Xlib. With permission from the
|
||||
* original authors of this file, the contents of this file are also
|
||||
* redistributable under the terms of the Mozilla Public license. For
|
||||
* information about the Mozilla Public License, please see the
|
||||
* license information at http://www.mozilla.org/MPL/
|
||||
*/
|
||||
|
||||
/* This code is copyright the following authors:
|
||||
* Raph Levien <raph@acm.org>
|
||||
* Manish Singh <manish@gtk.org>
|
||||
* Tim Janik <timj@gtk.org>
|
||||
* Peter Mattis <petm@xcf.berkeley.edu>
|
||||
* Spencer Kimball <spencer@xcf.berkeley.edu>
|
||||
* Josh MacDonald <jmacd@xcf.berkeley.edu>
|
||||
* Christopher Blizzard <blizzard@redhat.com>
|
||||
* Owen Taylor <otaylor@redhat.com>
|
||||
* Shawn T. Amundson <amundson@gtk.org>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __XLIB_RGB_H__
|
||||
#define __XLIB_RGB_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
typedef struct _XlibRgbCmap XlibRgbCmap;
|
||||
|
||||
struct _XlibRgbCmap {
|
||||
unsigned int colors[256];
|
||||
unsigned char lut[256]; /* for 8-bit modes */
|
||||
};
|
||||
|
||||
void
|
||||
xlib_rgb_init (Display *display, Screen *screen);
|
||||
void
|
||||
xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth);
|
||||
|
||||
unsigned long
|
||||
xlib_rgb_xpixel_from_rgb (guint32 rgb);
|
||||
|
||||
void
|
||||
xlib_rgb_gc_set_foreground (GC gc, guint32 rgb);
|
||||
|
||||
void
|
||||
xlib_rgb_gc_set_background (GC gc, guint32 rgb);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
XLIB_RGB_DITHER_NONE,
|
||||
XLIB_RGB_DITHER_NORMAL,
|
||||
XLIB_RGB_DITHER_MAX
|
||||
} XlibRgbDither;
|
||||
|
||||
void
|
||||
xlib_draw_rgb_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *rgb_buf,
|
||||
int rowstride);
|
||||
|
||||
void
|
||||
xlib_draw_rgb_image_dithalign (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *rgb_buf,
|
||||
int rowstride,
|
||||
int xdith,
|
||||
int ydith);
|
||||
|
||||
void
|
||||
xlib_draw_rgb_32_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *buf,
|
||||
int rowstride);
|
||||
|
||||
void
|
||||
xlib_draw_gray_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *buf,
|
||||
int rowstride);
|
||||
|
||||
XlibRgbCmap *
|
||||
xlib_rgb_cmap_new (guint32 *colors, int n_colors);
|
||||
|
||||
void
|
||||
xlib_rgb_cmap_free (XlibRgbCmap *cmap);
|
||||
|
||||
void
|
||||
xlib_draw_indexed_image (Drawable drawable,
|
||||
GC gc,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
XlibRgbDither dith,
|
||||
unsigned char *buf,
|
||||
int rowstride,
|
||||
XlibRgbCmap *cmap);
|
||||
|
||||
/* Below are some functions which are primarily useful for debugging
|
||||
and experimentation. */
|
||||
Bool
|
||||
xlib_rgb_ditherable (void);
|
||||
|
||||
void
|
||||
xlib_rgb_set_verbose (Bool verbose);
|
||||
|
||||
/* experimental colormap stuff */
|
||||
void
|
||||
xlib_rgb_set_install (Bool install);
|
||||
|
||||
void
|
||||
xlib_rgb_set_min_colors (int min_colors);
|
||||
|
||||
Colormap
|
||||
xlib_rgb_get_cmap (void);
|
||||
|
||||
Visual *
|
||||
xlib_rgb_get_visual (void);
|
||||
|
||||
XVisualInfo *
|
||||
xlib_rgb_get_visual_info (void);
|
||||
|
||||
int
|
||||
xlib_rgb_get_depth (void);
|
||||
|
||||
Display *
|
||||
xlib_rgb_get_display (void);
|
||||
|
||||
Screen *
|
||||
xlib_rgb_get_screen (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __XLIB_RGB_H__ */
|
@@ -1,11 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
.libs
|
||||
.deps
|
||||
testanimation
|
||||
test-inline-pixbufs.h
|
||||
testpixbuf-drawable
|
||||
testpixbuf-scale
|
||||
testpixbuf-save
|
||||
testpixbuf
|
||||
pixbuf-demo
|
@@ -1,80 +0,0 @@
|
||||
## Makefile.am for gtk+/demos
|
||||
|
||||
SUBDIRS = gtk-demo
|
||||
|
||||
INCLUDES = @STRIP_BEGIN@ \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir)/gdk \
|
||||
-DGTK_DISABLE_COMPAT_H \
|
||||
@GTK_DEBUG_FLAGS@ \
|
||||
@GTK_XIM_FLAGS@ \
|
||||
@GTK_LOCALE_FLAGS@ \
|
||||
@PANGO_CFLAGS@ \
|
||||
@GLIB_CFLAGS@ \
|
||||
@more_cflags@ \
|
||||
@STRIP_END@
|
||||
|
||||
DEPS = \
|
||||
$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-1.3.la \
|
||||
$(top_builddir)/gdk/@gdktargetlib@ \
|
||||
$(top_builddir)/gtk/@gtktargetlib@
|
||||
|
||||
LDADDS = @STRIP_BEGIN@ \
|
||||
$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-1.3.la \
|
||||
$(top_builddir)/gdk/@gdktargetlib@ \
|
||||
$(top_builddir)/gtk/@gtktargetlib@ \
|
||||
@more_ldflags@ \
|
||||
@more_libs@ \
|
||||
@GDK_WLIBS@ \
|
||||
@PANGO_LIBS@ \
|
||||
@GLIB_LIBS@ \
|
||||
@GTK_LIBS_EXTRA@ \
|
||||
-lm \
|
||||
@STRIP_END@
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
testpixbuf \
|
||||
testpixbuf-drawable \
|
||||
testanimation \
|
||||
testpixbuf-save \
|
||||
testpixbuf-scale \
|
||||
pixbuf-demo
|
||||
|
||||
BUILT_SOURCES=test-inline-pixbufs.h
|
||||
|
||||
test-inline-pixbufs.h: $(top_builddir)/gdk-pixbuf/make-inline-pixbuf apple-red.png gnome-foot.png
|
||||
(topdir=`cd $(top_builddir) && pwd` ; curdir=`pwd` ; \
|
||||
cd $(srcdir) && \
|
||||
GDK_PIXBUF_MODULEDIR=$$topdir/gdk-pixbuf/.libs $$topdir/gdk-pixbuf/make-inline-pixbuf $$curdir/test-inline-pixbufs.h apple_red apple-red.png gnome_foot gnome-foot.png)
|
||||
|
||||
testpixbuf_DEPENDENCIES = $(DEPS)
|
||||
testpixbuf_drawable_DEPENDENCIES = $(DEPS)
|
||||
testpixbuf_save_DEPENDENCIES = $(DEPS)
|
||||
testpixbuf_scale_DEPENDENCIES = $(DEPS)
|
||||
testanimation_DEPENDENCIES = $(DEPS)
|
||||
pixbuf_demo_DEPENDENCIES = $(DEPS)
|
||||
|
||||
testpixbuf_LDADD = $(LDADDS)
|
||||
testpixbuf_drawable_LDADD = $(LDADDS)
|
||||
testpixbuf_save_LDADD = $(LDADDS)
|
||||
testpixbuf_scale_LDADD = $(LDADDS)
|
||||
testanimation_LDADD = $(LDADDS)
|
||||
pixbuf_demo_LDADD = $(LDADDS)
|
||||
|
||||
testpixbuf_SOURCES = testpixbuf.c pixbuf-init.c
|
||||
testpixbuf_drawable_SOURCES = testpixbuf-drawable.c pixbuf-init.c
|
||||
testpixbuf_save_SOURCES = testpixbuf-save.c
|
||||
testpixbuf_scale_SOURCES = testpixbuf-scale.c pixbuf-init.c
|
||||
testanimation_SOURCES = testanimation.c pixbuf-init.c
|
||||
pixbuf_demo_SOURCES = pixbuf-demo.c pixbuf-init.c
|
||||
|
||||
EXTRA_DIST = \
|
||||
apple-red.png \
|
||||
background.jpg \
|
||||
gnome-applets.png \
|
||||
gnome-calendar.png \
|
||||
gnome-foot.png \
|
||||
gnome-gimp.png \
|
||||
gnome-gmush.png \
|
||||
gnome-gsame.png \
|
||||
gnu-keys.png
|
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 3.8 KiB |
@@ -1,7 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
.libs
|
||||
.deps
|
||||
gtk-demo
|
||||
demos.h
|
||||
|
@@ -1,62 +0,0 @@
|
||||
## Makefile.am for gtk+/demos
|
||||
|
||||
democodedir=$(datadir)/gtk-2.0/demo
|
||||
|
||||
demos = @STRIP_BEGIN@ \
|
||||
button_box.c \
|
||||
item_factory.c \
|
||||
menus.c \
|
||||
panes.c \
|
||||
textview.c \
|
||||
@STRIP_END@
|
||||
|
||||
INCLUDES = @STRIP_BEGIN@ \
|
||||
-DDEMOCODEDIR="\"$(democodedir)\"" \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir)/gdk \
|
||||
-DGTK_DISABLE_COMPAT_H \
|
||||
@GTK_DEBUG_FLAGS@ \
|
||||
@GTK_XIM_FLAGS@ \
|
||||
@GTK_LOCALE_FLAGS@ \
|
||||
@PANGO_CFLAGS@ \
|
||||
@GLIB_CFLAGS@ \
|
||||
@more_cflags@ \
|
||||
@STRIP_END@
|
||||
|
||||
DEPS = \
|
||||
$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-1.3.la \
|
||||
$(top_builddir)/gdk/@gdktargetlib@ \
|
||||
$(top_builddir)/gtk/@gtktargetlib@
|
||||
|
||||
LDADDS = @STRIP_BEGIN@ \
|
||||
$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-1.3.la \
|
||||
$(top_builddir)/gdk/@gdktargetlib@ \
|
||||
$(top_builddir)/gtk/@gtktargetlib@ \
|
||||
@more_ldflags@ \
|
||||
@more_libs@ \
|
||||
@GDK_WLIBS@ \
|
||||
@PANGO_LIBS@ \
|
||||
@GLIB_LIBS@ \
|
||||
@GTK_LIBS_EXTRA@ \
|
||||
-lm \
|
||||
@STRIP_END@
|
||||
|
||||
bin_PROGRAMS = gtk-demo
|
||||
|
||||
BUILT_SOURCES = demos.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
geninclude.pl
|
||||
|
||||
demos.h: $(demos) geninclude.pl
|
||||
(cd $(srcdir) && ./geninclude.pl $(demos) > demos.h)
|
||||
|
||||
gtk_demo_SOURCES = \
|
||||
$(demos) \
|
||||
main.c \
|
||||
demos.h
|
||||
|
||||
gtk_demo_DEPENDENCIES = $(DEPS)
|
||||
gtk_demo_LDADD = $(LDADDS)
|
||||
|
||||
democode_DATA = $(demos)
|
@@ -1,129 +0,0 @@
|
||||
/* Button Boxes
|
||||
*
|
||||
* The Button Box widgets are used to arrange buttons with padding.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *
|
||||
create_bbox (gint horizontal,
|
||||
char* title,
|
||||
gint spacing,
|
||||
gint child_w,
|
||||
gint child_h,
|
||||
gint layout)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *bbox;
|
||||
GtkWidget *button;
|
||||
|
||||
frame = gtk_frame_new (title);
|
||||
|
||||
if (horizontal)
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
else
|
||||
bbox = gtk_vbutton_box_new ();
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
|
||||
gtk_container_add (GTK_CONTAINER (frame), bbox);
|
||||
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout);
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), spacing);
|
||||
gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), child_w, child_h);
|
||||
|
||||
button = gtk_button_new_with_label ("OK");
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
|
||||
button = gtk_button_new_with_label ("Cancel");
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
|
||||
button = gtk_button_new_with_label ("Help");
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_button_box (void)
|
||||
{
|
||||
static GtkWidget* window = NULL;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *frame_horz;
|
||||
GtkWidget *frame_vert;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), main_vbox);
|
||||
|
||||
frame_horz = gtk_frame_new ("Horizontal Button Boxes");
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame_horz, TRUE, TRUE, 10);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
|
||||
gtk_container_add (GTK_CONTAINER (frame_horz), vbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "Spread", 40, 85, 20, GTK_BUTTONBOX_SPREAD),
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "Edge", 40, 85, 20, GTK_BUTTONBOX_EDGE),
|
||||
TRUE, TRUE, 5);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "Start", 40, 85, 20, GTK_BUTTONBOX_START),
|
||||
TRUE, TRUE, 5);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "End", 40, 85, 20, GTK_BUTTONBOX_END),
|
||||
TRUE, TRUE, 5);
|
||||
|
||||
frame_vert = gtk_frame_new ("Vertical Button Boxes");
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), frame_vert, TRUE, TRUE, 10);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
|
||||
gtk_container_add (GTK_CONTAINER (frame_vert), hbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "Spread", 30, 85, 20, GTK_BUTTONBOX_SPREAD),
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "Edge", 30, 85, 20, GTK_BUTTONBOX_EDGE),
|
||||
TRUE, TRUE, 5);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "Start", 30, 85, 20, GTK_BUTTONBOX_START),
|
||||
TRUE, TRUE, 5);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "End", 30, 85, 20, GTK_BUTTONBOX_END),
|
||||
TRUE, TRUE, 5);
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
@@ -1,42 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
print <<EOT;
|
||||
typedef GtkWidget *(*GDoDemoFunc) (void);
|
||||
|
||||
typedef struct _Demo Demo;
|
||||
|
||||
struct _Demo
|
||||
{
|
||||
gchar *title;
|
||||
gchar *filename;
|
||||
GDoDemoFunc func;
|
||||
};
|
||||
|
||||
EOT
|
||||
|
||||
$array = "";
|
||||
$first = 1;
|
||||
for $file (@ARGV) {
|
||||
|
||||
($basename = $file) =~ s/\.c$//;
|
||||
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$array .= ",\n";
|
||||
}
|
||||
|
||||
open INFO_FILE, $file or die "Cannot open '$file'\n";
|
||||
$title = <INFO_FILE>;
|
||||
$title =~ s@^\s*/\*\s*@@;
|
||||
$title =~ s@\s*$@@;
|
||||
|
||||
close INFO_FILE;
|
||||
|
||||
print "GtkWidget *do_$basename (void);\n";
|
||||
$array .= qq( { "$title", "$file", do_$basename });
|
||||
}
|
||||
|
||||
print "\nDemo testgtk_demos[] = {";
|
||||
print $array;
|
||||
print "\n};\n";
|
@@ -1,42 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
print <<EOT;
|
||||
typedef GtkWidget *(*GDoDemoFunc) (void);
|
||||
|
||||
typedef struct _Demo Demo;
|
||||
|
||||
struct _Demo
|
||||
{
|
||||
gchar *title;
|
||||
gchar *filename;
|
||||
GDoDemoFunc func;
|
||||
};
|
||||
|
||||
EOT
|
||||
|
||||
$array = "";
|
||||
$first = 1;
|
||||
for $file (@ARGV) {
|
||||
|
||||
($basename = $file) =~ s/\.c$//;
|
||||
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
$array .= ",\n";
|
||||
}
|
||||
|
||||
open INFO_FILE, $file or die "Cannot open '$file'\n";
|
||||
$title = <INFO_FILE>;
|
||||
$title =~ s@^\s*/\*\s*@@;
|
||||
$title =~ s@\s*$@@;
|
||||
|
||||
close INFO_FILE;
|
||||
|
||||
print "GtkWidget *do_$basename (void);\n";
|
||||
$array .= qq( { "$title", "$file", do_$basename });
|
||||
}
|
||||
|
||||
print "\nDemo testgtk_demos[] = {";
|
||||
print $array;
|
||||
print "\n};\n";
|
@@ -1,123 +0,0 @@
|
||||
/* Item Factory
|
||||
*
|
||||
* The GtkItemFactory object allows the easy creation of menus
|
||||
* from an array of descriptions of menu items.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
gtk_ifactory_cb (gpointer callback_data,
|
||||
guint callback_action,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
g_message ("ItemFactory: activated \"%s\"", gtk_item_factory_path_from_widget (widget));
|
||||
}
|
||||
|
||||
static GtkItemFactoryEntry menu_items[] =
|
||||
{
|
||||
{ "/_File", NULL, 0, 0, "<Branch>" },
|
||||
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
|
||||
{ "/File/_New", "<control>N", gtk_ifactory_cb, 0 },
|
||||
{ "/File/_Open", "<control>O", gtk_ifactory_cb, 0 },
|
||||
{ "/File/_Save", "<control>S", gtk_ifactory_cb, 0 },
|
||||
{ "/File/Save _As...", NULL, gtk_ifactory_cb, 0 },
|
||||
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
|
||||
{ "/File/_Quit", "<control>Q", gtk_ifactory_cb, 0 },
|
||||
|
||||
{ "/_Preferences", NULL, 0, 0, "<Branch>" },
|
||||
{ "/_Preferences/_Color", NULL, 0, 0, "<Branch>" },
|
||||
{ "/_Preferences/Color/_Red", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
|
||||
{ "/_Preferences/Color/_Green", NULL, gtk_ifactory_cb, 0, "/Preferences/Color/Red" },
|
||||
{ "/_Preferences/Color/_Blue", NULL, gtk_ifactory_cb, 0, "/Preferences/Color/Red" },
|
||||
{ "/_Preferences/_Shape", NULL, 0, 0, "<Branch>" },
|
||||
{ "/_Preferences/Shape/_Square", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
|
||||
{ "/_Preferences/Shape/_Rectangle", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" },
|
||||
{ "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" },
|
||||
|
||||
{ "/_Help", NULL, 0, 0, "<LastBranch>" },
|
||||
{ "/Help/_About", NULL, gtk_ifactory_cb, 0 },
|
||||
};
|
||||
|
||||
static int nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
|
||||
|
||||
GtkWidget *
|
||||
do_item_factory (void)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *box1;
|
||||
GtkWidget *box2;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GtkAccelGroup *accel_group;
|
||||
GtkItemFactory *item_factory;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
|
||||
&window);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete-event",
|
||||
GTK_SIGNAL_FUNC (gtk_true),
|
||||
NULL);
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
|
||||
gtk_object_set_data_full (GTK_OBJECT (window),
|
||||
"<main>",
|
||||
item_factory,
|
||||
(GtkDestroyNotify) gtk_object_unref);
|
||||
gtk_accel_group_attach (accel_group, GTK_OBJECT (window));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Item Factory");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
|
||||
|
||||
/* preselect /Preferences/Shape/Oval over the other radios
|
||||
*/
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_item_factory_get_item (item_factory,
|
||||
"/Preferences/Shape/Oval")),
|
||||
TRUE);
|
||||
|
||||
box1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), box1);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box1),
|
||||
gtk_item_factory_get_widget (item_factory, "<main>"),
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new ("Type\n<alt>\nto start");
|
||||
gtk_widget_set_usize (label, 200, 200);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, TRUE, TRUE, 0);
|
||||
|
||||
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
|
||||
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("close");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
@@ -1,449 +0,0 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <demos.h>
|
||||
|
||||
static GtkTextBuffer *info_buffer;
|
||||
static GtkTextBuffer *source_buffer;
|
||||
|
||||
static gchar *current_file = NULL;
|
||||
|
||||
enum {
|
||||
TITLE_COLUMN,
|
||||
FILENAME_COLUMN,
|
||||
FUNC_COLUMN,
|
||||
ITALIC_COLUMN,
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
typedef struct _CallbackData CallbackData;
|
||||
struct _CallbackData
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreePath *path;
|
||||
};
|
||||
|
||||
static void
|
||||
window_closed_cb (GtkWidget *window, gpointer data)
|
||||
{
|
||||
CallbackData *cbdata = data;
|
||||
GtkTreeIter iter;
|
||||
gboolean italic;
|
||||
|
||||
gtk_tree_model_get_iter (cbdata->model, &iter, cbdata->path);
|
||||
gtk_tree_store_get (GTK_TREE_STORE (cbdata->model), &iter,
|
||||
ITALIC_COLUMN, &italic,
|
||||
-1);
|
||||
if (italic)
|
||||
gtk_tree_store_set (GTK_TREE_STORE (cbdata->model), &iter,
|
||||
ITALIC_COLUMN, !italic,
|
||||
-1);
|
||||
|
||||
gtk_tree_path_free (cbdata->path);
|
||||
g_free (cbdata);
|
||||
}
|
||||
|
||||
gboolean
|
||||
read_line (FILE *stream, GString *str)
|
||||
{
|
||||
int n_read = 0;
|
||||
|
||||
flockfile (stream);
|
||||
|
||||
g_string_truncate (str, 0);
|
||||
|
||||
while (1)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = getc_unlocked (stream);
|
||||
|
||||
if (c == EOF)
|
||||
goto done;
|
||||
else
|
||||
n_read++;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
{
|
||||
int next_c = getc_unlocked (stream);
|
||||
|
||||
if (!(next_c == EOF ||
|
||||
(c == '\r' && next_c == '\n') ||
|
||||
(c == '\n' && next_c == '\r')))
|
||||
ungetc (next_c, stream);
|
||||
|
||||
goto done;
|
||||
}
|
||||
default:
|
||||
g_string_append_c (str, c);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
funlockfile (stream);
|
||||
|
||||
return n_read > 0;
|
||||
}
|
||||
|
||||
void
|
||||
load_file (const gchar *filename)
|
||||
{
|
||||
FILE *file;
|
||||
GtkTextIter start, end;
|
||||
GString *buffer = g_string_new (NULL);
|
||||
int state = 0;
|
||||
gboolean in_para = 0;
|
||||
|
||||
if (current_file && !strcmp (current_file, filename))
|
||||
return;
|
||||
|
||||
g_free (current_file);
|
||||
current_file = g_strdup (filename);
|
||||
|
||||
gtk_text_buffer_get_bounds (info_buffer, &start, &end);
|
||||
gtk_text_buffer_delete (info_buffer, &start, &end);
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
gtk_text_buffer_delete (source_buffer, &start, &end);
|
||||
|
||||
file = fopen (filename, "r");
|
||||
|
||||
if (!file)
|
||||
{
|
||||
char *installed = g_strconcat (DEMOCODEDIR,
|
||||
G_DIR_SEPARATOR_S,
|
||||
filename,
|
||||
NULL);
|
||||
|
||||
file = fopen (installed, "r");
|
||||
|
||||
g_free (installed);
|
||||
}
|
||||
|
||||
if (!file)
|
||||
{
|
||||
g_warning ("Cannot open %s: %s\n", filename, g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_iter_at_offset (info_buffer, &start, 0);
|
||||
while (read_line (file, buffer))
|
||||
{
|
||||
gchar *p = buffer->str;
|
||||
gchar *q;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
/* Reading title */
|
||||
while (*p == '/' || *p == '*' || isspace (*p))
|
||||
p++;
|
||||
q = p + strlen (p);
|
||||
while (q > p && isspace (*(q - 1)))
|
||||
q--;
|
||||
|
||||
if (q > p)
|
||||
{
|
||||
int len_chars = g_utf8_pointer_to_offset (p, q);
|
||||
|
||||
end = start;
|
||||
|
||||
g_assert (strlen (p) >= q - p);
|
||||
gtk_text_buffer_insert (info_buffer, &end, p, q - p);
|
||||
start = end;
|
||||
|
||||
gtk_text_iter_backward_chars (&start, len_chars);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "title", &start, &end);
|
||||
|
||||
start = end;
|
||||
|
||||
state++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* Reading body of info section */
|
||||
while (isspace (*p))
|
||||
p++;
|
||||
if (*p == '*' && *(p + 1) == '/')
|
||||
{
|
||||
gtk_text_buffer_get_iter_at_offset (source_buffer, &start, 0);
|
||||
state++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len;
|
||||
|
||||
while (*p == '*' || isspace (*p))
|
||||
p++;
|
||||
|
||||
len = strlen (p);
|
||||
while (isspace (*(p + len - 1)))
|
||||
len--;
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
if (in_para)
|
||||
gtk_text_buffer_insert (info_buffer, &start, " ", 1);
|
||||
|
||||
g_assert (strlen (p) >= len);
|
||||
gtk_text_buffer_insert (info_buffer, &start, p, len);
|
||||
in_para = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_buffer_insert (info_buffer, &start, "\n", 1);
|
||||
in_para = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* Skipping blank lines */
|
||||
while (isspace (*p))
|
||||
p++;
|
||||
if (*p)
|
||||
{
|
||||
p = buffer->str;
|
||||
state++;
|
||||
/* Fall through */
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* Reading program body */
|
||||
gtk_text_buffer_insert (source_buffer, &start, p, -1);
|
||||
gtk_text_buffer_insert (info_buffer, &start, "\n", 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "source", &start, &end);
|
||||
}
|
||||
|
||||
gboolean
|
||||
button_press_event_cb (GtkTreeView *tree_view,
|
||||
GdkEventButton *event,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
if (event->type == GDK_2BUTTON_PRESS)
|
||||
{
|
||||
GtkTreePath *path = NULL;
|
||||
|
||||
gtk_tree_view_get_path_at_pos (tree_view,
|
||||
event->window,
|
||||
event->x,
|
||||
event->y,
|
||||
&path,
|
||||
NULL);
|
||||
|
||||
if (path)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean italic;
|
||||
GDoDemoFunc func;
|
||||
GtkWidget *window;
|
||||
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
gtk_tree_store_get (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
FUNC_COLUMN, &func,
|
||||
ITALIC_COLUMN, &italic,
|
||||
-1);
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
ITALIC_COLUMN, !italic,
|
||||
-1);
|
||||
window = (func) ();
|
||||
if (window != NULL)
|
||||
{
|
||||
CallbackData *cbdata;
|
||||
|
||||
cbdata = g_new (CallbackData, 1);
|
||||
cbdata->model = model;
|
||||
cbdata->path = path;
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window),
|
||||
"destroy",
|
||||
window_closed_cb,
|
||||
cbdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (tree_view),
|
||||
"button_press_event");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
selection_cb (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GValue value = {0, };
|
||||
|
||||
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
return;
|
||||
|
||||
gtk_tree_model_get_value (model, &iter,
|
||||
FILENAME_COLUMN,
|
||||
&value);
|
||||
load_file (g_value_get_string (&value));
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_text (GtkTextBuffer **buffer,
|
||||
gboolean is_source)
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *text_view;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_SHADOW_IN);
|
||||
|
||||
text_view = gtk_text_view_new ();
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
|
||||
|
||||
*buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), *buffer);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
|
||||
if (is_source)
|
||||
{
|
||||
font_desc = pango_font_description_from_string ("Courier 10");
|
||||
gtk_widget_modify_font (text_view, font_desc);
|
||||
pango_font_description_free (font_desc);
|
||||
}
|
||||
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), !is_source);
|
||||
|
||||
return scrolled_window;
|
||||
}
|
||||
|
||||
/* Technically a list, but if we do go to 80 demos, we may want to move to a tree */
|
||||
static GtkWidget *
|
||||
create_tree (void)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkCellRenderer *cell;
|
||||
GtkWidget *tree_view;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreeStore *model;
|
||||
GtkTreeIter iter;
|
||||
gint i;
|
||||
|
||||
model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
|
||||
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
||||
|
||||
gtk_tree_selection_set_type (GTK_TREE_SELECTION (selection),
|
||||
GTK_TREE_SELECTION_SINGLE);
|
||||
gtk_widget_set_usize (tree_view, 200, -1);
|
||||
|
||||
for (i=0; i < G_N_ELEMENTS (testgtk_demos); i++)
|
||||
{
|
||||
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
|
||||
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
TITLE_COLUMN, testgtk_demos[i].title,
|
||||
FILENAME_COLUMN, testgtk_demos[i].filename,
|
||||
FUNC_COLUMN, testgtk_demos[i].func,
|
||||
ITALIC_COLUMN, FALSE,
|
||||
-1);
|
||||
}
|
||||
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes ("Widget (double click for demo)",
|
||||
cell,
|
||||
"text", TITLE_COLUMN,
|
||||
"italic", ITALIC_COLUMN,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
|
||||
GTK_TREE_VIEW_COLUMN (column));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", selection_cb, model);
|
||||
gtk_signal_connect (GTK_OBJECT (tree_view), "button_press_event", GTK_SIGNAL_FUNC (button_press_event_cb), model);
|
||||
|
||||
return tree_view;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *tree;
|
||||
GtkTextTag *tag;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
tree = create_tree ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), tree, FALSE, FALSE, 0);
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0);
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
create_text (&info_buffer, FALSE),
|
||||
gtk_label_new ("Info"));
|
||||
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
create_text (&source_buffer, TRUE),
|
||||
gtk_label_new ("Source"));
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "title");
|
||||
gtk_object_set (GTK_OBJECT (tag),
|
||||
"font", "Sans 18",
|
||||
NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "source");
|
||||
gtk_object_set (GTK_OBJECT (tag),
|
||||
"font", "Courier 10",
|
||||
"pixels_above_lines", 0,
|
||||
"pixels_below_lines", 0,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
|
||||
load_file (testgtk_demos[0].filename);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,194 +0,0 @@
|
||||
/* Menus
|
||||
*
|
||||
* GTK+ includes a number of widgets for menus of actions.
|
||||
* GtkMenu is a drop-down menu, GtkMenuBar a horizontal menu bar.
|
||||
* Each of these widgets can hold various types of menuitem.
|
||||
* As well as the base type, GtkMenuItem, there are GtkCheckMenuItem,
|
||||
* GtkRadioMenuItem and GtkTearoffMenuItem.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
static GtkWidget*
|
||||
create_menu (gint depth, gboolean tearoff)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
GSList *group;
|
||||
char buf[32];
|
||||
int i, j;
|
||||
|
||||
if (depth < 1)
|
||||
return NULL;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
group = NULL;
|
||||
|
||||
if (tearoff)
|
||||
{
|
||||
menuitem = gtk_tearoff_menu_item_new ();
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
}
|
||||
|
||||
for (i = 0, j = 1; i < 5; i++, j++)
|
||||
{
|
||||
sprintf (buf, "item %2d - %d", depth, j);
|
||||
menuitem = gtk_radio_menu_item_new_with_label (group, buf);
|
||||
group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
|
||||
if (depth % 2)
|
||||
gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (menuitem), TRUE);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
if (i == 3)
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1, TRUE));
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_menus (void)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *box1;
|
||||
GtkWidget *box2;
|
||||
GtkWidget *button;
|
||||
GtkWidget *optionmenu;
|
||||
GtkWidget *separator;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *menubar;
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
GtkAccelGroup *accel_group;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
|
||||
&window);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete-event",
|
||||
GTK_SIGNAL_FUNC (gtk_true),
|
||||
NULL);
|
||||
|
||||
accel_group = gtk_accel_group_new ();
|
||||
gtk_accel_group_attach (accel_group, GTK_OBJECT (window));
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "menus");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
|
||||
box1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), box1);
|
||||
gtk_widget_show (box1);
|
||||
|
||||
menubar = gtk_menu_bar_new ();
|
||||
gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
|
||||
gtk_widget_show (menubar);
|
||||
|
||||
menu = create_menu (2, TRUE);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("test\nline2");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
|
||||
gtk_menu_bar_append (GTK_MENU_BAR (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("foo");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3, TRUE));
|
||||
gtk_menu_bar_append (GTK_MENU_BAR (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("bar");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4, TRUE));
|
||||
gtk_menu_item_right_justify (GTK_MENU_ITEM (menuitem));
|
||||
gtk_menu_bar_append (GTK_MENU_BAR (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
menu = create_menu (1, FALSE);
|
||||
gtk_menu_set_accel_group (GTK_MENU (menu), accel_group);
|
||||
|
||||
menuitem = gtk_check_menu_item_new_with_label ("Accelerate Me");
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_widget_add_accelerator (menuitem,
|
||||
"activate",
|
||||
accel_group,
|
||||
GDK_F1,
|
||||
0,
|
||||
GTK_ACCEL_VISIBLE | GTK_ACCEL_SIGNAL_VISIBLE);
|
||||
menuitem = gtk_check_menu_item_new_with_label ("Accelerator Locked");
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_widget_add_accelerator (menuitem,
|
||||
"activate",
|
||||
accel_group,
|
||||
GDK_F2,
|
||||
0,
|
||||
GTK_ACCEL_VISIBLE | GTK_ACCEL_LOCKED);
|
||||
menuitem = gtk_check_menu_item_new_with_label ("Accelerators Frozen");
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_widget_add_accelerator (menuitem,
|
||||
"activate",
|
||||
accel_group,
|
||||
GDK_F2,
|
||||
0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_add_accelerator (menuitem,
|
||||
"activate",
|
||||
accel_group,
|
||||
GDK_F3,
|
||||
0,
|
||||
GTK_ACCEL_VISIBLE);
|
||||
gtk_widget_lock_accelerators (menuitem);
|
||||
|
||||
optionmenu = gtk_option_menu_new ();
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (optionmenu), 3);
|
||||
gtk_box_pack_start (GTK_BOX (box2), optionmenu, TRUE, TRUE, 0);
|
||||
gtk_widget_show (optionmenu);
|
||||
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
button = gtk_button_new_with_label ("close");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
@@ -1,195 +0,0 @@
|
||||
/* Paned Widgets
|
||||
*
|
||||
* The GtkHPaned and GtkVPaned Widgets divide their content
|
||||
* area into two panes with a divider in between that the
|
||||
* user can adjust. A separate child is placed into each
|
||||
* pane.
|
||||
*
|
||||
* There are a number of options that can be set for each pane.
|
||||
* This test contains both a horizontal (HPaned) and a vertical
|
||||
* (VPaned) widget, and allows you to adjust the options for
|
||||
* each side of each widget.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void
|
||||
toggle_resize (GtkWidget *widget, GtkWidget *child)
|
||||
{
|
||||
GtkPaned *paned = GTK_PANED (child->parent);
|
||||
gboolean is_child1 = (child == paned->child1);
|
||||
gboolean resize, shrink;
|
||||
|
||||
resize = is_child1 ? paned->child1_resize : paned->child2_resize;
|
||||
shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink;
|
||||
|
||||
gtk_widget_ref (child);
|
||||
gtk_container_remove (GTK_CONTAINER (child->parent), child);
|
||||
if (is_child1)
|
||||
gtk_paned_pack1 (paned, child, !resize, shrink);
|
||||
else
|
||||
gtk_paned_pack2 (paned, child, !resize, shrink);
|
||||
gtk_widget_unref (child);
|
||||
}
|
||||
|
||||
void
|
||||
toggle_shrink (GtkWidget *widget, GtkWidget *child)
|
||||
{
|
||||
GtkPaned *paned = GTK_PANED (child->parent);
|
||||
gboolean is_child1 = (child == paned->child1);
|
||||
gboolean resize, shrink;
|
||||
|
||||
resize = is_child1 ? paned->child1_resize : paned->child2_resize;
|
||||
shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink;
|
||||
|
||||
gtk_widget_ref (child);
|
||||
gtk_container_remove (GTK_CONTAINER (child->parent), child);
|
||||
if (is_child1)
|
||||
gtk_paned_pack1 (paned, child, resize, !shrink);
|
||||
else
|
||||
gtk_paned_pack2 (paned, child, resize, !shrink);
|
||||
gtk_widget_unref (child);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_pane_options (GtkPaned *paned,
|
||||
const gchar *frame_label,
|
||||
const gchar *label1,
|
||||
const gchar *label2)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *check_button;
|
||||
|
||||
frame = gtk_frame_new (frame_label);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
|
||||
|
||||
table = gtk_table_new (3, 2, 4);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
|
||||
label = gtk_label_new (label1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label,
|
||||
0, 1, 0, 1);
|
||||
|
||||
check_button = gtk_check_button_new_with_label ("Resize");
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
|
||||
0, 1, 1, 2);
|
||||
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
|
||||
GTK_SIGNAL_FUNC (toggle_resize),
|
||||
paned->child1);
|
||||
|
||||
check_button = gtk_check_button_new_with_label ("Shrink");
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
|
||||
0, 1, 2, 3);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
|
||||
TRUE);
|
||||
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
|
||||
GTK_SIGNAL_FUNC (toggle_shrink),
|
||||
paned->child1);
|
||||
|
||||
label = gtk_label_new (label2);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), label,
|
||||
1, 2, 0, 1);
|
||||
|
||||
check_button = gtk_check_button_new_with_label ("Resize");
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
|
||||
1, 2, 1, 2);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
|
||||
TRUE);
|
||||
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
|
||||
GTK_SIGNAL_FUNC (toggle_resize),
|
||||
paned->child2);
|
||||
|
||||
check_button = gtk_check_button_new_with_label ("Shrink");
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
|
||||
1, 2, 2, 3);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
|
||||
TRUE);
|
||||
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
|
||||
GTK_SIGNAL_FUNC (toggle_shrink),
|
||||
paned->child2);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_panes (void)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *hpaned;
|
||||
GtkWidget *vpaned;
|
||||
GtkWidget *button;
|
||||
GtkWidget *vbox;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Panes");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
vpaned = gtk_vpaned_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), vpaned, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5);
|
||||
|
||||
hpaned = gtk_hpaned_new ();
|
||||
gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_usize (frame, 60, 60);
|
||||
gtk_paned_add1 (GTK_PANED (hpaned), frame);
|
||||
|
||||
button = gtk_button_new_with_label ("Hi there");
|
||||
gtk_container_add (GTK_CONTAINER(frame), button);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_usize (frame, 80, 60);
|
||||
gtk_paned_add2 (GTK_PANED (hpaned), frame);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_usize (frame, 60, 80);
|
||||
gtk_paned_add2 (GTK_PANED (vpaned), frame);
|
||||
|
||||
/* Now create toggle buttons to control sizing */
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_pane_options (GTK_PANED (hpaned),
|
||||
"Horizontal",
|
||||
"Left",
|
||||
"Right"),
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_pane_options (GTK_PANED (vpaned),
|
||||
"Vertical",
|
||||
"Top",
|
||||
"Bottom"),
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show_all (vbox);
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
@@ -1,356 +0,0 @@
|
||||
/* Text Widget
|
||||
*
|
||||
* The GtkTextView widget displays a GtkTextBuffer. One GtkTextBuffer
|
||||
* can be displayed by multiple GtkTextViews. This demo has two views
|
||||
* displaying a single buffer, and shows off the widget's text
|
||||
* formatting features.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Don't copy this bad example; inline RGB data is always a better
|
||||
* idea than inline XPMs.
|
||||
*/
|
||||
static char *book_closed_xpm[] = {
|
||||
"16 16 6 1",
|
||||
" c None s None",
|
||||
". c black",
|
||||
"X c red",
|
||||
"o c yellow",
|
||||
"O c #808080",
|
||||
"# c white",
|
||||
" ",
|
||||
" .. ",
|
||||
" ..XX. ",
|
||||
" ..XXXXX. ",
|
||||
" ..XXXXXXXX. ",
|
||||
".ooXXXXXXXXX. ",
|
||||
"..ooXXXXXXXXX. ",
|
||||
".X.ooXXXXXXXXX. ",
|
||||
".XX.ooXXXXXX.. ",
|
||||
" .XX.ooXXX..#O ",
|
||||
" .XX.oo..##OO. ",
|
||||
" .XX..##OO.. ",
|
||||
" .X.#OO.. ",
|
||||
" ..O.. ",
|
||||
" .. ",
|
||||
" "
|
||||
};
|
||||
|
||||
|
||||
#define gray50_width 2
|
||||
#define gray50_height 2
|
||||
static char gray50_bits[] = {
|
||||
0x02, 0x01
|
||||
};
|
||||
|
||||
/* FIXME once TextTag is a GObject remove these awful hacks ;-) */
|
||||
#define g_object_set gtk_object_set
|
||||
#undef G_OBJECT
|
||||
#define G_OBJECT(x) ((void*)x)
|
||||
|
||||
static void
|
||||
create_tags (GtkTextBuffer *buffer)
|
||||
{
|
||||
GtkTextTag *tag;
|
||||
GdkBitmap *stipple;
|
||||
|
||||
/* Create a bunch of tags. Note that it's also possible to
|
||||
* create tags with gtk_text_tag_new() then add them to the
|
||||
* tag table for the buffer, gtk_text_buffer_create_tag() is
|
||||
* just a convenience function. Also note that you don't have
|
||||
* to give tags a name; pass NULL for the name to create an
|
||||
* anonymous tag.
|
||||
*
|
||||
* In any real app, another useful optimization would be to create
|
||||
* a GtkTextTagTable in advance, and reuse the same tag table for
|
||||
* all the buffers with the same tag set, instead of creating
|
||||
* new copies of the same tags for every buffer.
|
||||
*
|
||||
* Tags are assigned default priorities in order of addition to the
|
||||
* tag table. That is, tags created later that affect the same
|
||||
* text property as an earlier tag will override the earlier tag.
|
||||
* You can modify tag priorities with gtk_text_tag_set_priority().
|
||||
*/
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "italic");
|
||||
g_object_set (G_OBJECT (tag), "style", PANGO_STYLE_ITALIC, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "bold");
|
||||
g_object_set (G_OBJECT (tag), "weight", PANGO_WEIGHT_BOLD, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "big");
|
||||
/* 70 points times the PANGO_SCALE factor */
|
||||
g_object_set (G_OBJECT (tag), "size", 45 * PANGO_SCALE, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "blue_foreground");
|
||||
g_object_set (G_OBJECT (tag), "foreground", "blue", NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "red_background");
|
||||
g_object_set (G_OBJECT (tag), "background", "red", NULL);
|
||||
|
||||
stipple = gdk_bitmap_create_from_data (NULL,
|
||||
gray50_bits, gray50_width,
|
||||
gray50_height);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "background_stipple");
|
||||
g_object_set (G_OBJECT (tag), "background_stipple", stipple, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "foreground_stipple");
|
||||
g_object_set (G_OBJECT (tag), "foreground_stipple", stipple, NULL);
|
||||
|
||||
g_object_unref (G_OBJECT (stipple));
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "big_gap_before_line");
|
||||
g_object_set (G_OBJECT (tag), "pixels_above_lines", 30, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "big_gap_after_line");
|
||||
g_object_set (G_OBJECT (tag), "pixels_below_lines", 30, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "double_spaced_line");
|
||||
g_object_set (G_OBJECT (tag), "pixels_inside_wrap", 10, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "not_editable");
|
||||
g_object_set (G_OBJECT (tag), "editable", FALSE, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "word_wrap");
|
||||
g_object_set (G_OBJECT (tag), "wrap_mode", GTK_WRAPMODE_WORD, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "char_wrap");
|
||||
g_object_set (G_OBJECT (tag), "wrap_mode", GTK_WRAPMODE_CHAR, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "no_wrap");
|
||||
g_object_set (G_OBJECT (tag), "wrap_mode", GTK_WRAPMODE_NONE, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "center");
|
||||
g_object_set (G_OBJECT (tag), "justify", GTK_JUSTIFY_CENTER, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "right_justify");
|
||||
g_object_set (G_OBJECT (tag), "justify", GTK_JUSTIFY_RIGHT, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "wide_margins");
|
||||
g_object_set (G_OBJECT (tag),
|
||||
"left_margin", 50, "right_margin", 50,
|
||||
NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "strikethrough");
|
||||
g_object_set (G_OBJECT (tag), "strikethrough", TRUE, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "underline");
|
||||
g_object_set (G_OBJECT (tag), "underline", PANGO_UNDERLINE_SINGLE, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "double_underline");
|
||||
g_object_set (G_OBJECT (tag), "underline", PANGO_UNDERLINE_DOUBLE, NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "superscript");
|
||||
g_object_set (G_OBJECT (tag),
|
||||
"rise", 10 * PANGO_SCALE, /* 10 pixels */
|
||||
"size", 8 * PANGO_SCALE, /* 8 points */
|
||||
NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, "subscript");
|
||||
g_object_set (G_OBJECT (tag),
|
||||
"rise", -10 * PANGO_SCALE, /* 10 pixels */
|
||||
"size", 8 * PANGO_SCALE, /* 8 points */
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
insert_text (GtkTextBuffer *buffer)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextIter start, end;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) book_closed_xpm);
|
||||
|
||||
/* get start of buffer; each insertion will revalidate the
|
||||
* iterator to point to just after the inserted text.
|
||||
*/
|
||||
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, "The text widget can display text with all kinds of nifty attributes.\n", -1);
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, "For example, you can have ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"italic", -1,
|
||||
"italic", NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, ", ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"bold", -1,
|
||||
"bold", NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, ", or ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"huge", -1,
|
||||
"big", NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, " text. ", -1);
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, "Also, colors such as ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"a blue foreground", -1,
|
||||
"blue_foreground", NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, " or ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"a red background", -1,
|
||||
"red_background", NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, " or even ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"a stippled red background", -1,
|
||||
"red_background",
|
||||
"background_stipple",
|
||||
NULL);
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, " or ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"a stippled blue foreground on solid red background", -1,
|
||||
"blue_foreground",
|
||||
"red_background",
|
||||
"foreground_stipple",
|
||||
NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, " (select that to read it) can be used.\n", -1);
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"Strikethrough", -1,
|
||||
"strikethrough", NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, ", ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"underline", -1,
|
||||
"underline", NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, ", ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"double underline", -1,
|
||||
"double_underline", NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, ", ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"superscript", -1,
|
||||
"superscript", NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, ", and ", -1);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"subscript", -1,
|
||||
"subscript", NULL);
|
||||
gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, "The buffer can have images in it: ", -1);
|
||||
gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
|
||||
gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
|
||||
gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
|
||||
gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"You can adjust the amount of space before each line; this line has a whole lot of space before it.\n", -1,
|
||||
"big_gap_before_line", NULL);
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", -1,
|
||||
"big_gap_after_line", NULL);
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"Of course you can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line.\n", -1,
|
||||
"double_spaced_line", NULL);
|
||||
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n", -1,
|
||||
"not_editable", NULL);
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"If char wrap worked, this line would be char wrapped, but since char wrap isn't yet implemented, this line will fall back to word wrap.\n", -1,
|
||||
"char_wrap", NULL);
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n", -1,
|
||||
"no_wrap", NULL);
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"This line has center justification.\n", -1,
|
||||
"center", NULL);
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"This line has right justification.\n", -1,
|
||||
"right_justify", NULL);
|
||||
|
||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||
"This line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", -1,
|
||||
"wide_margins", NULL);
|
||||
|
||||
gtk_text_buffer_insert (buffer, &iter, "This demo doesn't even demonstrate all the GtkTextBuffer features; it leaves out, for example: invisible/hidden text, tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...", -1);
|
||||
|
||||
/* Apply word_wrap tag to whole buffer */
|
||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (buffer, "word_wrap", &start, &end);
|
||||
|
||||
g_object_unref (G_OBJECT (pixbuf));
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_textview (void)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *vpaned;
|
||||
GtkWidget *view1;
|
||||
GtkWidget *view2;
|
||||
GtkWidget *sw;
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
300, 400);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "TextView");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
vpaned = gtk_vpaned_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5);
|
||||
gtk_container_add (GTK_CONTAINER (window), vpaned);
|
||||
|
||||
/* For convenience, we just use the autocreated buffer from
|
||||
* the first text view; you could also create the buffer
|
||||
* by itself with gtk_text_buffer_new(), then later create
|
||||
* a view widget.
|
||||
*/
|
||||
view1 = gtk_text_view_new ();
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view1));
|
||||
view2 = gtk_text_view_new_with_buffer (buffer);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_paned_add1 (GTK_PANED (vpaned), sw);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), view1);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_paned_add2 (GTK_PANED (vpaned), sw);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), view2);
|
||||
|
||||
create_tags (buffer);
|
||||
insert_text (buffer);
|
||||
|
||||
gtk_widget_show_all (vpaned);
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
@@ -1,234 +0,0 @@
|
||||
/* GdkPixbuf library - Scaling and compositing demo
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Authors: Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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 <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
|
||||
#define FRAME_DELAY 50
|
||||
|
||||
#define BACKGROUND_NAME "background.jpg"
|
||||
|
||||
static const char *image_names[] = {
|
||||
"apple-red.png",
|
||||
"gnome-applets.png",
|
||||
"gnome-calendar.png",
|
||||
"gnome-foot.png",
|
||||
"gnome-gmush.png",
|
||||
"gnome-gimp.png",
|
||||
"gnome-gsame.png",
|
||||
"gnu-keys.png"
|
||||
};
|
||||
|
||||
#define N_IMAGES (sizeof (image_names) / sizeof (image_names[0]))
|
||||
|
||||
/* Current frame */
|
||||
static GdkPixbuf *frame;
|
||||
|
||||
/* Background image */
|
||||
static GdkPixbuf *background;
|
||||
int back_width, back_height;
|
||||
|
||||
/* Images */
|
||||
static GdkPixbuf *images[N_IMAGES];
|
||||
|
||||
/* Widgets */
|
||||
GtkWidget *da;
|
||||
|
||||
|
||||
|
||||
/* Loads the images for the demo and returns whether the operation succeeded */
|
||||
static gboolean
|
||||
load_pixbufs (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* We pass NULL for the error return location, we don't care
|
||||
* about the error message.
|
||||
*/
|
||||
|
||||
background = gdk_pixbuf_new_from_file (BACKGROUND_NAME, NULL);
|
||||
if (!background)
|
||||
return FALSE;
|
||||
|
||||
back_width = gdk_pixbuf_get_width (background);
|
||||
back_height = gdk_pixbuf_get_height (background);
|
||||
|
||||
for (i = 0; i < N_IMAGES; i++) {
|
||||
images[i] = gdk_pixbuf_new_from_file (image_names[i], NULL);
|
||||
if (!images[i])
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Expose callback for the drawing area */
|
||||
static gint
|
||||
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
guchar *pixels;
|
||||
int rowstride;
|
||||
|
||||
rowstride = gdk_pixbuf_get_rowstride (frame);
|
||||
|
||||
pixels = gdk_pixbuf_get_pixels (frame) + rowstride * event->area.y + event->area.x * 3;
|
||||
|
||||
gdk_draw_rgb_image_dithalign (widget->window,
|
||||
widget->style->black_gc,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width, event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
pixels, rowstride,
|
||||
event->area.x, event->area.y);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define CYCLE_LEN 60
|
||||
|
||||
static int frame_num;
|
||||
|
||||
/* Timeout handler to regenerate the frame */
|
||||
static gint
|
||||
timeout (gpointer data)
|
||||
{
|
||||
double f;
|
||||
int i;
|
||||
double xmid, ymid;
|
||||
double radius;
|
||||
|
||||
gdk_pixbuf_copy_area (background, 0, 0, back_width, back_height,
|
||||
frame, 0, 0);
|
||||
|
||||
f = (double) (frame_num % CYCLE_LEN) / CYCLE_LEN;
|
||||
|
||||
xmid = back_width / 2.0;
|
||||
ymid = back_height / 2.0;
|
||||
|
||||
radius = MIN (xmid, ymid) / 2.0;
|
||||
|
||||
for (i = 0; i < N_IMAGES; i++) {
|
||||
double ang;
|
||||
int xpos, ypos;
|
||||
int iw, ih;
|
||||
double r;
|
||||
GdkRectangle r1, r2, dest;
|
||||
double k;
|
||||
|
||||
ang = 2.0 * M_PI * (double) i / N_IMAGES - f * 2.0 * M_PI;
|
||||
|
||||
iw = gdk_pixbuf_get_width (images[i]);
|
||||
ih = gdk_pixbuf_get_height (images[i]);
|
||||
|
||||
r = radius + (radius / 3.0) * sin (f * 2.0 * M_PI);
|
||||
|
||||
xpos = floor (xmid + r * cos (ang) - iw / 2.0 + 0.5);
|
||||
ypos = floor (ymid + r * sin (ang) - ih / 2.0 + 0.5);
|
||||
|
||||
k = (i & 1) ? sin (f * 2.0 * M_PI) : cos (f * 2.0 * M_PI);
|
||||
k = 2.0 * k * k;
|
||||
k = MAX (0.25, k);
|
||||
|
||||
r1.x = xpos;
|
||||
r1.y = ypos;
|
||||
r1.width = iw * k;
|
||||
r1.height = ih * k;
|
||||
|
||||
r2.x = 0;
|
||||
r2.y = 0;
|
||||
r2.width = back_width;
|
||||
r2.height = back_height;
|
||||
|
||||
if (gdk_rectangle_intersect (&r1, &r2, &dest))
|
||||
gdk_pixbuf_composite (images[i],
|
||||
frame,
|
||||
dest.x, dest.y,
|
||||
dest.width, dest.height,
|
||||
xpos, ypos,
|
||||
k, k,
|
||||
GDK_INTERP_NEAREST,
|
||||
((i & 1)
|
||||
? MAX (127, fabs (255 * sin (f * 2.0 * M_PI)))
|
||||
: MAX (127, fabs (255 * cos (f * 2.0 * M_PI)))));
|
||||
}
|
||||
|
||||
gtk_widget_draw (da, NULL);
|
||||
|
||||
frame_num++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint timeout_id;
|
||||
|
||||
/* Destroy handler for the window */
|
||||
static void
|
||||
destroy_cb (GtkObject *object, gpointer data)
|
||||
{
|
||||
gtk_timeout_remove (timeout_id);
|
||||
timeout_id = 0;
|
||||
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
extern void pixbuf_init();
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
pixbuf_init ();
|
||||
gtk_init (&argc, &argv);
|
||||
gdk_rgb_init ();
|
||||
|
||||
if (!load_pixbufs ()) {
|
||||
g_message ("main(): Could not load all the pixbufs!");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, back_width, back_height);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_usize (window, back_width, back_height);
|
||||
gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy_cb), NULL);
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (da), "expose_event",
|
||||
GTK_SIGNAL_FUNC (expose_cb), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), da);
|
||||
|
||||
timeout_id = gtk_timeout_add (FRAME_DELAY, timeout, NULL);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static gboolean
|
||||
file_exists (const char *filename)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
return stat (filename, &statbuf) == 0;
|
||||
}
|
||||
|
||||
void
|
||||
pixbuf_init ()
|
||||
{
|
||||
if (file_exists ("../gdk-pixbuf/.libs/libpixbufloader-pnm.so"))
|
||||
putenv ("GDK_PIXBUF_MODULEDIR=../gdk-pixbuf/.libs");
|
||||
}
|
@@ -3,28 +3,29 @@
|
||||
* Copyright (C) 1999 Mark Crichton, Larry Ewing
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gdk-pixbuf-loader.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
#include "gdk-pixbuf-loader.h"
|
||||
|
||||
typedef struct {
|
||||
FILE *imagefile;
|
||||
@@ -200,17 +201,22 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
|
||||
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
||||
|
||||
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
|
||||
if (!pixbuf->art_pixbuf) {
|
||||
g_warning ("art_pixbuf is NULL in expose_func!!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pixbuf->art_pixbuf->has_alpha) {
|
||||
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,
|
||||
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));
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
} else {
|
||||
gdk_draw_rgb_image (drawing_area->window,
|
||||
drawing_area->style->white_gc,
|
||||
@@ -218,10 +224,10 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
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));
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,9 +238,11 @@ 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) != gdk_pixbuf_get_width (pixbuf)) ||
|
||||
((event->height) != gdk_pixbuf_get_height (pixbuf)))
|
||||
if (((event->width) != (pixbuf->art_pixbuf->width)) ||
|
||||
((event->height) != (pixbuf->art_pixbuf->height)))
|
||||
gdk_pixbuf_scale(pixbuf, event->width, event->height);
|
||||
#endif
|
||||
}
|
||||
@@ -249,8 +257,8 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
|
||||
GtkWidget *drawing_area;
|
||||
gint w, h;
|
||||
|
||||
w = gdk_pixbuf_get_width (pixbuf);
|
||||
h = gdk_pixbuf_get_height (pixbuf);
|
||||
w = pixbuf->art_pixbuf->width;
|
||||
h = pixbuf->art_pixbuf->height;
|
||||
|
||||
window = gtk_widget_new (gtk_window_get_type (),
|
||||
"GtkObject::user_data", NULL,
|
||||
@@ -300,7 +308,6 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
|
||||
return window;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
static gint
|
||||
update_timeout(gpointer data)
|
||||
@@ -362,12 +369,8 @@ progressive_updated_callback(GdkPixbufLoader* loader, guint x, guint y, guint wi
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static int readlen = 4096;
|
||||
|
||||
extern void pixbuf_init();
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -375,8 +378,7 @@ main (int argc, char **argv)
|
||||
int found_valid = FALSE;
|
||||
|
||||
GdkPixbufAnimation *animation;
|
||||
|
||||
pixbuf_init ();
|
||||
GdkPixbufLoader *pixbuf_loader;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
@@ -385,6 +387,7 @@ main (int argc, char **argv)
|
||||
gdk_rgb_init ();
|
||||
|
||||
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
|
||||
gtk_widget_set_default_visual (gdk_rgb_get_visual ());
|
||||
|
||||
{
|
||||
char *tbf_readlen = getenv("TBF_READLEN");
|
||||
@@ -408,41 +411,14 @@ main (int argc, char **argv)
|
||||
return 0;
|
||||
} else {
|
||||
for (i = 1; i < argc; i++) {
|
||||
GError *error;
|
||||
|
||||
error = NULL;
|
||||
animation = gdk_pixbuf_animation_new_from_file (argv[i],
|
||||
&error);
|
||||
animation = gdk_pixbuf_animation_new_from_file (argv[i]);
|
||||
|
||||
if (animation == NULL) {
|
||||
g_warning ("Failed to load animation: %s",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
if (animation) {
|
||||
gint i = 0;
|
||||
GList *listptr;
|
||||
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++;
|
||||
for (listptr = animation->frames; listptr; listptr = listptr->next){
|
||||
g_print ("in a frame\n");
|
||||
new_testrgb_window (((GdkPixbufFrame *)listptr->data)->pixbuf, "File");
|
||||
}
|
||||
found_valid = TRUE;
|
||||
}
|
||||
@@ -451,7 +427,6 @@ main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget* rgb_window = NULL;
|
||||
ProgressFileStatus status;
|
||||
GdkPixbufLoader *pixbuf_loader;
|
||||
|
||||
pixbuf_loader = gdk_pixbuf_loader_new ();
|
||||
status.loader = pixbuf_loader;
|
||||
|
@@ -1,392 +0,0 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <demos.h>
|
||||
|
||||
static GtkTextBuffer *info_buffer;
|
||||
static GtkTextBuffer *source_buffer;
|
||||
|
||||
static gchar *current_file = NULL;
|
||||
|
||||
enum {
|
||||
TITLE_COLUMN,
|
||||
FILENAME_COLUMN,
|
||||
FUNC_COLUMN,
|
||||
ITALIC_COLUMN,
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
gboolean
|
||||
read_line (FILE *stream, GString *str)
|
||||
{
|
||||
int n_read = 0;
|
||||
|
||||
flockfile (stream);
|
||||
|
||||
g_string_truncate (str, 0);
|
||||
|
||||
while (1)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = getc_unlocked (stream);
|
||||
|
||||
if (c == EOF)
|
||||
goto done;
|
||||
else
|
||||
n_read++;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
{
|
||||
int next_c = getc_unlocked (stream);
|
||||
|
||||
if (!(next_c == EOF ||
|
||||
(c == '\r' && next_c == '\n') ||
|
||||
(c == '\n' && next_c == '\r')))
|
||||
ungetc (next_c, stream);
|
||||
|
||||
goto done;
|
||||
}
|
||||
default:
|
||||
g_string_append_c (str, c);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
funlockfile (stream);
|
||||
|
||||
return n_read > 0;
|
||||
}
|
||||
|
||||
void
|
||||
load_file (const gchar *filename)
|
||||
{
|
||||
FILE *file;
|
||||
GtkTextIter start, end;
|
||||
GString *buffer = g_string_new (NULL);
|
||||
int state = 0;
|
||||
gboolean in_para = 0;
|
||||
|
||||
if (current_file && !strcmp (current_file, filename))
|
||||
return;
|
||||
|
||||
g_free (current_file);
|
||||
current_file = g_strdup (filename);
|
||||
|
||||
gtk_text_buffer_get_bounds (info_buffer, &start, &end);
|
||||
gtk_text_buffer_delete (info_buffer, &start, &end);
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
gtk_text_buffer_delete (source_buffer, &start, &end);
|
||||
|
||||
file = fopen (filename, "r");
|
||||
if (!file)
|
||||
{
|
||||
g_warning ("Cannot open %s: %s\n", filename, g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_iter_at_offset (info_buffer, &start, 0);
|
||||
while (read_line (file, buffer))
|
||||
{
|
||||
gchar *p = buffer->str;
|
||||
gchar *q;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
/* Reading title */
|
||||
while (*p == '/' || *p == '*' || isspace (*p))
|
||||
p++;
|
||||
q = p + strlen (p);
|
||||
while (q > p && isspace (*(q - 1)))
|
||||
q--;
|
||||
|
||||
if (q > p)
|
||||
{
|
||||
int len_chars = g_utf8_pointer_to_offset (p, q);
|
||||
|
||||
end = start;
|
||||
|
||||
g_assert (strlen (p) >= q - p);
|
||||
gtk_text_buffer_insert (info_buffer, &end, p, q - p);
|
||||
start = end;
|
||||
|
||||
gtk_text_iter_backward_chars (&start, len_chars);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "title", &start, &end);
|
||||
|
||||
start = end;
|
||||
|
||||
state++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* Reading body of info section */
|
||||
while (isspace (*p))
|
||||
p++;
|
||||
if (*p == '*' && *(p + 1) == '/')
|
||||
{
|
||||
gtk_text_buffer_get_iter_at_offset (source_buffer, &start, 0);
|
||||
state++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len;
|
||||
|
||||
while (*p == '*' || isspace (*p))
|
||||
p++;
|
||||
|
||||
len = strlen (p);
|
||||
while (isspace (*(p + len - 1)))
|
||||
len--;
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
if (in_para)
|
||||
gtk_text_buffer_insert (info_buffer, &start, " ", 1);
|
||||
|
||||
g_assert (strlen (p) >= len);
|
||||
gtk_text_buffer_insert (info_buffer, &start, p, len);
|
||||
in_para = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_buffer_insert (info_buffer, &start, "\n", 1);
|
||||
in_para = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* Skipping blank lines */
|
||||
while (isspace (*p))
|
||||
p++;
|
||||
if (*p)
|
||||
{
|
||||
p = buffer->str;
|
||||
state++;
|
||||
/* Fall through */
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* Reading program body */
|
||||
gtk_text_buffer_insert (source_buffer, &start, p, -1);
|
||||
gtk_text_buffer_insert (info_buffer, &start, "\n", 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "source", &start, &end);
|
||||
}
|
||||
|
||||
gboolean
|
||||
button_press_event_cb (GtkTreeView *tree_view,
|
||||
GdkEventButton *event,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
if (event->type == GDK_2BUTTON_PRESS)
|
||||
{
|
||||
GtkTreePath *path = NULL;
|
||||
|
||||
gtk_tree_view_get_path_at_pos (tree_view,
|
||||
event->window,
|
||||
event->x,
|
||||
event->y,
|
||||
&path,
|
||||
NULL);
|
||||
|
||||
if (path)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean italic;
|
||||
GVoidFunc func;
|
||||
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
gtk_tree_store_get (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
FUNC_COLUMN, &func,
|
||||
ITALIC_COLUMN, &italic,
|
||||
-1);
|
||||
(func) ();
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
ITALIC_COLUMN, !italic,
|
||||
-1);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (tree_view),
|
||||
"button_press_event");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
selection_cb (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GValue value = {0, };
|
||||
|
||||
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
return;
|
||||
|
||||
gtk_tree_model_get_value (model, &iter,
|
||||
FILENAME_COLUMN,
|
||||
&value);
|
||||
load_file (g_value_get_string (&value));
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_text (GtkTextBuffer **buffer,
|
||||
gboolean is_source)
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *text_view;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_SHADOW_IN);
|
||||
|
||||
text_view = gtk_text_view_new ();
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
|
||||
|
||||
*buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), *buffer);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
|
||||
if (is_source)
|
||||
{
|
||||
font_desc = pango_font_description_from_string ("Courier 10");
|
||||
gtk_widget_modify_font (text_view, font_desc);
|
||||
pango_font_description_free (font_desc);
|
||||
}
|
||||
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), !is_source);
|
||||
|
||||
return scrolled_window;
|
||||
}
|
||||
|
||||
/* Technically a list, but if we do go to 80 demos, we may want to move to a tree */
|
||||
static GtkWidget *
|
||||
create_tree (void)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkCellRenderer *cell;
|
||||
GtkWidget *tree_view;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreeStore *model;
|
||||
GtkTreeIter iter;
|
||||
gint i;
|
||||
|
||||
model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
|
||||
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
||||
|
||||
gtk_tree_selection_set_type (GTK_TREE_SELECTION (selection),
|
||||
GTK_TREE_SELECTION_SINGLE);
|
||||
gtk_widget_set_usize (tree_view, 200, -1);
|
||||
|
||||
for (i=0; i < G_N_ELEMENTS (testgtk_demos); i++)
|
||||
{
|
||||
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
|
||||
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
TITLE_COLUMN, testgtk_demos[i].title,
|
||||
FILENAME_COLUMN, testgtk_demos[i].filename,
|
||||
FUNC_COLUMN, testgtk_demos[i].func,
|
||||
ITALIC_COLUMN, FALSE,
|
||||
-1);
|
||||
}
|
||||
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes ("Widget",
|
||||
cell,
|
||||
"text", TITLE_COLUMN,
|
||||
"italic", ITALIC_COLUMN,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
|
||||
GTK_TREE_VIEW_COLUMN (column));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", selection_cb, model);
|
||||
gtk_signal_connect (GTK_OBJECT (tree_view), "button_press_event", GTK_SIGNAL_FUNC (button_press_event_cb), model);
|
||||
|
||||
return tree_view;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *tree;
|
||||
GtkTextTag *tag;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
tree = create_tree ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), tree, FALSE, FALSE, 0);
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0);
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
create_text (&info_buffer, FALSE),
|
||||
gtk_label_new ("Info"));
|
||||
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
create_text (&source_buffer, TRUE),
|
||||
gtk_label_new ("Source"));
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "title");
|
||||
gtk_object_set (GTK_OBJECT (tag),
|
||||
"font", "Sans 18",
|
||||
NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "source");
|
||||
gtk_object_set (GTK_OBJECT (tag),
|
||||
"font", "Courier 10",
|
||||
"pixels_above_lines", 0,
|
||||
"pixels_below_lines", 0,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
|
||||
load_file (testgtk_demos[0].filename);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,6 +1,7 @@
|
||||
#include <config.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/x11/gdkx.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
int close_app(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
@@ -14,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(gdk_pixbuf_get_has_alpha (pixbuf))
|
||||
if(pixbuf->art_pixbuf->has_alpha)
|
||||
{
|
||||
gdk_draw_rgb_32_image(drawing_area->window,
|
||||
drawing_area->style->black_gc,
|
||||
@@ -22,10 +23,10 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
|
||||
evt->area.width,
|
||||
evt->area.height,
|
||||
GDK_RGB_DITHER_MAX,
|
||||
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));
|
||||
pixbuf->art_pixbuf->pixels +
|
||||
(evt->area.y * pixbuf->art_pixbuf->rowstride) +
|
||||
(evt->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -35,10 +36,10 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
|
||||
evt->area.width,
|
||||
evt->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
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));
|
||||
pixbuf->art_pixbuf->pixels +
|
||||
(evt->area.y * pixbuf->art_pixbuf->rowstride) +
|
||||
(evt->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -51,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 != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf))
|
||||
if(evt->width != pixbuf->art_pixbuf->width || evt->height != pixbuf->art_pixbuf->height)
|
||||
{
|
||||
GdkWindow *root;
|
||||
GdkPixbuf *new_pixbuf;
|
||||
@@ -66,8 +67,6 @@ int configure_cb(GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extern void pixbuf_init();
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GdkWindow *root;
|
||||
@@ -76,13 +75,12 @@ int main(int argc, char **argv)
|
||||
GtkWidget *drawing_area;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf_init ();
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
gdk_rgb_set_verbose(TRUE);
|
||||
gdk_rgb_init();
|
||||
|
||||
gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
|
||||
gtk_widget_set_default_visual(gdk_rgb_get_visual());
|
||||
|
||||
root = GDK_ROOT_PARENT();
|
||||
pixbuf = gdk_pixbuf_get_from_drawable(NULL, root, NULL,
|
||||
@@ -99,8 +97,8 @@ int main(int argc, char **argv)
|
||||
|
||||
drawing_area = gtk_drawing_area_new();
|
||||
gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area),
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf));
|
||||
pixbuf->art_pixbuf->width,
|
||||
pixbuf->art_pixbuf->height);
|
||||
gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event",
|
||||
GTK_SIGNAL_FUNC(expose_cb), NULL);
|
||||
|
||||
|
@@ -1,154 +0,0 @@
|
||||
|
||||
#include <config.h>
|
||||
/* if building outside GTK, remove /x11 part */
|
||||
#include <gdk/x11/gdkx.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
void
|
||||
keypress_check (GtkWidget *widget, GdkEventKey *evt, gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkDrawingArea *da = (GtkDrawingArea*)data;
|
||||
GError *err = NULL;
|
||||
|
||||
pixbuf = (GdkPixbuf *) gtk_object_get_data (GTK_OBJECT (da), "pixbuf");
|
||||
|
||||
if (evt->keyval == 'q')
|
||||
gtk_main_quit ();
|
||||
if (evt->keyval == 's') {
|
||||
if (pixbuf == NULL) {
|
||||
fprintf (stderr, "PIXBUF NULL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gdk_pixbuf_save (pixbuf, "foo.jpg", "jpeg",
|
||||
&err,
|
||||
"quality", "100",
|
||||
NULL)) {
|
||||
fprintf (stderr, "%s", err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
|
||||
} else if (evt->keyval == 'p') {
|
||||
if (pixbuf == NULL) {
|
||||
fprintf (stderr, "PIXBUF NULL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gdk_pixbuf_save (pixbuf, "foo.png", "png", &err, NULL)) {
|
||||
fprintf (stderr, "%s", err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
close_app (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
expose_cb (GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = (GdkPixbuf *) gtk_object_get_data (GTK_OBJECT (drawing_area),
|
||||
"pixbuf");
|
||||
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
|
||||
gdk_draw_rgb_32_image (drawing_area->window,
|
||||
drawing_area->style->black_gc,
|
||||
evt->area.x, evt->area.y,
|
||||
evt->area.width,
|
||||
evt->area.height,
|
||||
GDK_RGB_DITHER_MAX,
|
||||
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 {
|
||||
gdk_draw_rgb_image (drawing_area->window,
|
||||
drawing_area->style->black_gc,
|
||||
evt->area.x, evt->area.y,
|
||||
evt->area.width,
|
||||
evt->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
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;
|
||||
}
|
||||
|
||||
int
|
||||
configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
pixbuf = (GdkPixbuf *) gtk_object_get_data (GTK_OBJECT (drawing_area),
|
||||
"pixbuf");
|
||||
|
||||
g_print ("X:%d Y:%d\n", evt->width, evt->height);
|
||||
if (evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf)) {
|
||||
GdkWindow *root;
|
||||
GdkPixbuf *new_pixbuf;
|
||||
|
||||
root = GDK_ROOT_PARENT ();
|
||||
new_pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
|
||||
0, 0, 0, 0, evt->width, evt->height);
|
||||
gtk_object_set_data (GTK_OBJECT (drawing_area), "pixbuf", new_pixbuf);
|
||||
gdk_pixbuf_unref (pixbuf);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GdkWindow *root;
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *drawing_area;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
|
||||
|
||||
root = GDK_ROOT_PARENT ();
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
|
||||
0, 0, 0, 0, 150, 160);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (close_app), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (close_app), NULL);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area),
|
||||
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);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "configure_event",
|
||||
GTK_SIGNAL_FUNC (configure_cb), NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "key_press_event",
|
||||
GTK_SIGNAL_FUNC (keypress_check), drawing_area);
|
||||
gtk_object_set_data (GTK_OBJECT (drawing_area), "pixbuf", pixbuf);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
@@ -1,16 +1,17 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
GdkInterpType interp_type = GDK_INTERP_BILINEAR;
|
||||
ArtFilterLevel filter_level = ART_FILTER_BILINEAR;
|
||||
int overall_alpha = 255;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *darea;
|
||||
|
||||
void
|
||||
set_interp_type (GtkWidget *widget, gpointer data)
|
||||
set_filter_level (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
interp_type = GPOINTER_TO_UINT (data);
|
||||
filter_level = GPOINTER_TO_UINT (data);
|
||||
gtk_widget_queue_draw (darea);
|
||||
}
|
||||
|
||||
@@ -31,14 +32,14 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
|
||||
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
|
||||
|
||||
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
|
||||
dest = gdk_pixbuf_new (ART_PIX_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 / gdk_pixbuf_get_width (pixbuf),
|
||||
(double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf),
|
||||
interp_type, overall_alpha,
|
||||
(double) widget->allocation.width / pixbuf->art_pixbuf->width,
|
||||
(double) widget->allocation.height / pixbuf->art_pixbuf->height,
|
||||
filter_level, 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],
|
||||
@@ -51,8 +52,6 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
extern void pixbuf_init();
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -62,9 +61,6 @@ main(int argc, char **argv)
|
||||
GtkWidget *hbox, *label, *hscale;
|
||||
GtkAdjustment *adjustment;
|
||||
GtkRequisition scratch_requisition;
|
||||
GError *error;
|
||||
|
||||
pixbuf_init ();
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gdk_rgb_init ();
|
||||
@@ -74,12 +70,9 @@ main(int argc, char **argv)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
error = NULL;
|
||||
pixbuf = gdk_pixbuf_new_from_file (argv[1], &error);
|
||||
pixbuf = gdk_pixbuf_new_from_file (argv[1]);
|
||||
if (!pixbuf) {
|
||||
fprintf (stderr, "Cannot load image: %s\n",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
fprintf (stderr, "Cannot load %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -94,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_interp_type),
|
||||
GUINT_TO_POINTER (GDK_INTERP_NEAREST));
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_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_interp_type),
|
||||
GUINT_TO_POINTER (GDK_INTERP_BILINEAR));
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_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_interp_type),
|
||||
GUINT_TO_POINTER (GDK_INTERP_TILES));
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_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_interp_type),
|
||||
GUINT_TO_POINTER (GDK_INTERP_HYPER));
|
||||
GTK_SIGNAL_FUNC (set_filter_level),
|
||||
GUINT_TO_POINTER (ART_FILTER_HYPER));
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
|
||||
optionmenu = gtk_option_menu_new ();
|
||||
@@ -152,8 +145,8 @@ main(int argc, char **argv)
|
||||
GTK_SIGNAL_FUNC (expose_cb), NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
scratch_requisition.height + gdk_pixbuf_get_height (pixbuf));
|
||||
pixbuf->art_pixbuf->width,
|
||||
scratch_requisition.height + pixbuf->art_pixbuf->height);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
|
@@ -1,31 +1,31 @@
|
||||
|
||||
/* testpixbuf -- test program for gdk-pixbuf code
|
||||
* Copyright (C) 1999 Mark Crichton, Larry Ewing
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* 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
|
||||
* Lesser General Public License for more details.
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gdk-pixbuf-loader.h>
|
||||
|
||||
#include "test-inline-pixbufs.h"
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
#include "gdk-pixbuf-loader.h"
|
||||
|
||||
typedef struct {
|
||||
FILE *imagefile;
|
||||
@@ -34,6 +34,7 @@ typedef struct {
|
||||
guchar *buf;
|
||||
guint timeout;
|
||||
guint readlen;
|
||||
|
||||
} ProgressFileStatus;
|
||||
|
||||
|
||||
@@ -320,17 +321,22 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
|
||||
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
|
||||
|
||||
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
|
||||
if (!pixbuf->art_pixbuf) {
|
||||
g_warning ("art_pixbuf is NULL in expose_func!!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (pixbuf->art_pixbuf->has_alpha) {
|
||||
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,
|
||||
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));
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
} else {
|
||||
gdk_draw_rgb_image (drawing_area->window,
|
||||
drawing_area->style->white_gc,
|
||||
@@ -338,10 +344,10 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
|
||||
event->area.width,
|
||||
event->area.height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
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));
|
||||
pixbuf->art_pixbuf->pixels
|
||||
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
|
||||
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
|
||||
pixbuf->art_pixbuf->rowstride);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,8 +361,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) != gdk_pixbuf_get_width (pixbuf)) ||
|
||||
((event->height) != gdk_pixbuf_get_height (pixbuf)))
|
||||
if (((event->width) != (pixbuf->art_pixbuf->width)) ||
|
||||
((event->height) != (pixbuf->art_pixbuf->height)))
|
||||
gdk_pixbuf_scale(pixbuf, event->width, event->height);
|
||||
#endif
|
||||
}
|
||||
@@ -370,15 +376,14 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
|
||||
GtkWidget *button;
|
||||
GtkWidget *drawing_area;
|
||||
gint w, h;
|
||||
|
||||
g_return_val_if_fail (pixbuf != NULL, NULL);
|
||||
w = gdk_pixbuf_get_width (pixbuf);
|
||||
h = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
w = pixbuf->art_pixbuf->width;
|
||||
h = pixbuf->art_pixbuf->height;
|
||||
|
||||
window = gtk_widget_new (gtk_window_get_type (),
|
||||
"GtkObject::user_data", NULL,
|
||||
"GtkWindow::type", GTK_WINDOW_TOPLEVEL,
|
||||
"GtkWindow::title", title ? title : "testrgb",
|
||||
"GtkWindow::title", "testrgb",
|
||||
"GtkWindow::allow_shrink", TRUE,
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
@@ -429,33 +434,17 @@ update_timeout(gpointer data)
|
||||
{
|
||||
ProgressFileStatus *status = data;
|
||||
gboolean done;
|
||||
GError *error;
|
||||
|
||||
done = FALSE;
|
||||
error = FALSE;
|
||||
|
||||
done = TRUE;
|
||||
if (!feof(status->imagefile)) {
|
||||
gint nbytes;
|
||||
|
||||
|
||||
nbytes = fread(status->buf, 1, status->readlen,
|
||||
status->imagefile);
|
||||
|
||||
|
||||
error = NULL;
|
||||
if (!gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (status->loader), status->buf, nbytes, &error)) {
|
||||
g_warning ("Error writing to loader: %s",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
done = TRUE;
|
||||
}
|
||||
|
||||
|
||||
} else { /* Really done */
|
||||
|
||||
GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf (status->loader);
|
||||
new_testrgb_window (pixbuf, "After progressive load");
|
||||
done = TRUE;
|
||||
|
||||
}
|
||||
done = !gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (status->loader), status->buf, nbytes);
|
||||
|
||||
}
|
||||
|
||||
if (done) {
|
||||
gtk_widget_queue_draw(*status->rgbwin);
|
||||
@@ -502,8 +491,6 @@ progressive_updated_callback(GdkPixbufLoader* loader, guint x, guint y, guint wi
|
||||
|
||||
static int readlen = 4096;
|
||||
|
||||
extern void pixbuf_init();
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -513,8 +500,6 @@ main (int argc, char **argv)
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbufLoader *pixbuf_loader;
|
||||
|
||||
pixbuf_init ();
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
gdk_rgb_set_verbose (TRUE);
|
||||
@@ -522,6 +507,7 @@ main (int argc, char **argv)
|
||||
gdk_rgb_init ();
|
||||
|
||||
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
|
||||
gtk_widget_set_default_visual (gdk_rgb_get_visual ());
|
||||
|
||||
{
|
||||
char *tbf_readlen = getenv("TBF_READLEN");
|
||||
@@ -543,7 +529,7 @@ main (int argc, char **argv)
|
||||
if (argc == 1) {
|
||||
const gchar*** xpmp;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_data (default_image, GDK_COLORSPACE_RGB, FALSE, 8,
|
||||
pixbuf = gdk_pixbuf_new_from_data (default_image, ART_PIX_RGB, FALSE,
|
||||
DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH * 3,
|
||||
NULL, NULL);
|
||||
new_testrgb_window (pixbuf, NULL);
|
||||
@@ -554,28 +540,12 @@ main (int argc, char **argv)
|
||||
new_testrgb_window (pixbuf, NULL);
|
||||
++xpmp;
|
||||
}
|
||||
|
||||
/* Test loading from inline data. */
|
||||
pixbuf = gdk_pixbuf_new_from_inline (apple_red, FALSE, -1, NULL);
|
||||
new_testrgb_window (pixbuf, "Red apple from inline data");
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_inline (gnome_foot, TRUE, sizeof (gnome_foot), NULL);
|
||||
new_testrgb_window (pixbuf, "Foot from inline data");
|
||||
|
||||
found_valid = TRUE;
|
||||
} else {
|
||||
for (i = 1; i < argc; i++) {
|
||||
GError *error;
|
||||
|
||||
error = NULL;
|
||||
pixbuf = gdk_pixbuf_new_from_file (argv[i], &error);
|
||||
|
||||
if (pixbuf == NULL) {
|
||||
g_warning ("Error loading image: %s",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (argv[i]);
|
||||
#if 0
|
||||
pixbuf = gdk_pixbuf_rotate(pixbuf, 10.0);
|
||||
#endif
|
||||
|
@@ -1,6 +1,7 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.html
|
||||
*.info*
|
||||
*.dvi
|
||||
*.ps
|
||||
*.pg
|
||||
|
21
docs/Changes-1.4.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
Incompatible Changes from GTK+-1.2 to GTK+-1.4:
|
||||
|
||||
- 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)
|
||||
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 *'.
|
||||
|
||||
- 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.
|
@@ -1,285 +0,0 @@
|
||||
Incompatible Changes from GTK+-1.2 to GTK+-2.0:
|
||||
|
||||
* gtk_container_get_toplevels() was removed and replaced with
|
||||
gtk_window_list_toplevels(), which has different memory management
|
||||
on the return value (gtk_window_list_toplevels() copies the GList
|
||||
and also references each widget in the list, so you have to
|
||||
g_list_free() the list after first unref'ing each list member).
|
||||
|
||||
* 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)
|
||||
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 *'.
|
||||
|
||||
* 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.
|
||||
|
||||
* Signal system changes:
|
||||
The Gtk 2.0 signal merly proxies the GSignal system now.
|
||||
For future usage, direct use of the GSignal API is recommended,
|
||||
this avoids significant performance hits where GtkArg structures
|
||||
have to be converted into GValues. For language bindings,
|
||||
GSignal+GClosure provide a much more flexible and convenient
|
||||
mechanism to hook into signal emissions or install class default
|
||||
handlers, so the old GtkSignal API for language bindings is not
|
||||
supported anymore.
|
||||
Functions that got removed in the Gtk signal API:
|
||||
gtk_signal_n_emissions(), gtk_signal_n_emissions_by_name(),
|
||||
gtk_signal_set_funcs(), gtk_signal_handler_pending_by_id(),
|
||||
gtk_signal_add_emission_hook(), gtk_signal_add_emission_hook_full(),
|
||||
gtk_signal_remove_emission_hook(), gtk_signal_query().
|
||||
gtk_signal_add_emission_hook(), gtk_signal_remove_emission_hook().
|
||||
Also, the GtkCallbackMarshal argument to gtk_signal_connect_full() is
|
||||
not supported anymore.
|
||||
For many of the removed functions, similar variants are available
|
||||
in the g_signal_* namespace.
|
||||
|
||||
- Inserting and deleting text in GtkEntry though functions such
|
||||
as gtk_entry_insert_text() now leave the cursor at its original
|
||||
position in the text instead of moving it to the location of
|
||||
the insertion/deletion.
|
||||
|
||||
- The ->label field of GtkFrame widgets has been removed. (As part of
|
||||
a change to allow the arbitrary widgets in the title position.) The
|
||||
text can now be retrieved with the new function gtk_frame_get_text().
|
||||
|
||||
- The 'font' and 'font_set' declarations in RC files are now ignored. There
|
||||
is a new 'font_name' field that holds the string form of a Pango font
|
||||
|
||||
- A number of types in GDK have become subclasses of GObject. For the
|
||||
most part, this should not break anyone's code. However, it's now
|
||||
possible/encouraged to use g_object_ref()/g_object_unref() and other
|
||||
GObject features with these GDK types. The converted types are:
|
||||
GdkWindow, GdkDrawable, GdkPixmap, GdkImage, GdkGC, GdkDragContext,
|
||||
GdkColormap
|
||||
|
||||
- All drawables including pixmaps used to have a type tag, the
|
||||
GdkWindowType enumeration, which included GDK_WINDOW_PIXMAP.
|
||||
GdkWindowType is now a property of GdkWindow _only_, and there is
|
||||
no GDK_WINDOW_PIXMAP. You can use the GDK_IS_PIXMAP() macro to see
|
||||
if you have a pixmap, if you need to know that.
|
||||
|
||||
- GtkStyle and GtkRcStyle are now subclasses of GObject as well. This
|
||||
requires fairly extensive changes to theme engines quite badly, but
|
||||
shouldn't affect most other code.
|
||||
|
||||
- xthickness/ythickness have moved from GtkStyleClass to GtkStyle
|
||||
(from class to instance). This gives themes a bit more flexibility
|
||||
and is generally more of the Right Thing. You can trivially fix
|
||||
your code with s/style->klass->xthickness/style->xthickness/g and
|
||||
same for ythickness.
|
||||
|
||||
- If you were using private GDK types, they have been rearranged
|
||||
significantly. You shouldn't use private types. ;-)
|
||||
|
||||
- The visual for a widget, and also the default visual is now derived
|
||||
from the colormap for the widget and the default colormap.
|
||||
gtk_widget_set_visual(), gtk_widget_set_default_visual(), gtk_widget_push_visual()
|
||||
and gtk_widget_pop_visual() now do nothing. Since the visual always
|
||||
had to match that of the colormap, it is safe to simply delete
|
||||
all references to these functions.
|
||||
|
||||
- A number of functions in GDK have been renamed for consistency and
|
||||
clarity. #defines to provide backwards compatibility have been
|
||||
included, but can be disabled by defineing GDK_DISABLE_COMPAT_H.
|
||||
|
||||
#define gdk_draw_pixmap gdk_draw_drawable
|
||||
#define gdk_draw_bitmap gdk_draw_drawable
|
||||
|
||||
#define gdk_window_get_size gdk_drawable_get_size
|
||||
#define gdk_window_get_type gdk_window_get_window_type
|
||||
#define gdk_window_get_colormap gdk_drawable_get_colormap
|
||||
#define gdk_window_set_colormap gdk_drawable_set_colormap
|
||||
#define gdk_window_get_visual gdk_drawable_get_visual
|
||||
|
||||
#define gdk_window_ref gdk_drawable_ref
|
||||
#define gdk_window_unref gdk_drawable_unref
|
||||
#define gdk_bitmap_ref gdk_drawable_ref
|
||||
#define gdk_bitmap_unref gdk_drawable_unref
|
||||
#define gdk_pixmap_ref gdk_drawable_ref
|
||||
#define gdk_pixmap_unref gdk_drawable_unref
|
||||
|
||||
#define gdk_gc_destroy gdk_gc_unref
|
||||
#define gdk_image_destroy gdk_image_unref
|
||||
#define gdk_cursor_destroy gdk_cursor_unref
|
||||
|
||||
(Note that g_object_ref() and g_object_unref() may be used for all of
|
||||
the above.)
|
||||
|
||||
#define gdk_window_copy_area(drawable,gc,x,y,source_drawable,source_x,source_y,width,height) \
|
||||
gdk_draw_pixmap(drawable,gc,source_drawable,source_x,source_y,x,y,width,height)
|
||||
|
||||
#define gdk_rgb_get_cmap gdk_rgb_get_colormap
|
||||
|
||||
- gdk_pixmap_foreign_new() no longer calls XFreePixmap() on the
|
||||
pixmap when the GdkPixmap is finalized. This change corresponds
|
||||
to the behavior of gdk_window_foreign_new(), and fixes a lot
|
||||
of problems with code where the pixmap wasn't supposed to be
|
||||
freed. If XFreePixmap() is needed, it can be done using the
|
||||
destroy-notification facilities of g_object_set_data().
|
||||
|
||||
- GtkProgress/GtkProgressBar had serious problems in GTK 1.2.
|
||||
|
||||
- Only 3 or 4 functions are really needed for 95% of progress
|
||||
interfaces; GtkProgress[Bar] had about 25 functions, and
|
||||
didn't even include these 3 or 4.
|
||||
- In activity mode, the API involves setting the adjustment
|
||||
to any random value, just to have the side effect of
|
||||
calling the progress bar update function - the adjustment
|
||||
is totally ignored in activity mode
|
||||
- You set the activity step as a pixel value, which means to
|
||||
set the activity step you basically need to connect to
|
||||
size_allocate
|
||||
- There are ctree_set_expander_style()-functions, to randomly
|
||||
change look-and-feel for no good reason
|
||||
- The split between GtkProgress and GtkProgressBar makes no sense
|
||||
to me whatsoever.
|
||||
|
||||
This was a big wart on GTK and made people waste lots of time,
|
||||
both learning and using the interface.
|
||||
|
||||
So, we have added what we feel is the correct API, and marked all the
|
||||
rest deprecated. However, the changes are 100% backward-compatible and
|
||||
should break no existing code.
|
||||
|
||||
The following 5 functions are the new programming interface and you
|
||||
should consider changing your code to use them:
|
||||
|
||||
void gtk_progress_bar_pulse (GtkProgressBar *pbar);
|
||||
void gtk_progress_bar_set_text (GtkProgressBar *pbar,
|
||||
const gchar *text);
|
||||
void gtk_progress_bar_set_fraction (GtkProgressBar *pbar,
|
||||
gfloat fraction);
|
||||
|
||||
void gtk_progress_bar_set_pulse_step (GtkProgressBar *pbar,
|
||||
gfloat fraction);
|
||||
void gtk_progress_bar_set_orientation (GtkProgressBar *pbar,
|
||||
GtkProgressBarOrientation orientation);
|
||||
|
||||
* The GtkNotebookPage structure has been removed from the public header files;
|
||||
this was never meant to be a public structure, and all functionality that
|
||||
could be done by accessing the struct fields of this structure should be
|
||||
accesible otherwise.
|
||||
|
||||
- GtkMenuPositionFunc has a new parameter push_in which controls how
|
||||
menus placed outside the screen is handled. If this is set to true and
|
||||
part of the menu is outside the screen then Gtk+ pushes it into the visible
|
||||
area. Otherwise the menu is cut of at the end of the visible screen area.
|
||||
|
||||
Regardles of what happens to the size of the menu, the result is always
|
||||
that the items are placed in the same place as if the menu was placed
|
||||
outside the screen, using menu scrolling if necessary.
|
||||
|
||||
- The "draw" signal and virtual method on GtkWidget has been removed.
|
||||
All drawing should now occur by invalidating a region of the widget
|
||||
(call gdk_window_invalidate_rect() or gtk_widget_queue_draw() for
|
||||
example to invalidate a region). GTK+ merges all invalid regions,
|
||||
and sends expose events to the widget in an idle handler for the
|
||||
invalid regions. gtk_widget_draw() is deprecated but still works; it
|
||||
adds the passed-in area to the invalid region and immediately sends
|
||||
expose events for the current invalid region.
|
||||
|
||||
Most widgets will work fine if you just delete their "draw"
|
||||
implementation, since they will already have working expose_event
|
||||
implementations. The draw method was rarely called in practice
|
||||
anyway.
|
||||
|
193
docs/Makefile.am
@@ -1,24 +1,201 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = tutorial faq reference
|
||||
info_TEXINFOS = gdk.texi gtk.texi
|
||||
|
||||
man_MANS = gtk-config.1
|
||||
|
||||
TUTORIAL_FR_FILES=html/gtk_tut_fr-1.html \
|
||||
html/gtk_tut_fr-2.html \
|
||||
html/gtk_tut_fr-3.html \
|
||||
html/gtk_tut_fr-4.html \
|
||||
html/gtk_tut_fr-5.html \
|
||||
html/gtk_tut_fr-6.html \
|
||||
html/gtk_tut_fr-7.html \
|
||||
html/gtk_tut_fr-8.html \
|
||||
html/gtk_tut_fr-9.html \
|
||||
html/gtk_tut_fr-10.html \
|
||||
html/gtk_tut_fr-11.html \
|
||||
html/gtk_tut_fr-12.html \
|
||||
html/gtk_tut_fr-13.html \
|
||||
html/gtk_tut_fr-14.html \
|
||||
html/gtk_tut_fr-15.html \
|
||||
html/gtk_tut_fr-16.html \
|
||||
html/gtk_tut_fr-17.html \
|
||||
html/gtk_tut_fr-18.html \
|
||||
html/gtk_tut_fr-19.html \
|
||||
html/gtk_tut_fr-20.html \
|
||||
html/gtk_tut_fr-21.html \
|
||||
html/gtk_tut_fr-22.html \
|
||||
html/gtk_tut_fr-23.html \
|
||||
html/gtk_tut_fr-24.html \
|
||||
html/gtk_tut_fr.html text/gtk_tut_fr.txt
|
||||
|
||||
TUTORIAL_FILES=text/gtk_tut.txt html/gtk_tut.html \
|
||||
html/gtk_tut.html \
|
||||
html/gtk_tut-1.html \
|
||||
html/gtk_tut-2.html \
|
||||
html/gtk_tut-3.html \
|
||||
html/gtk_tut-4.html \
|
||||
html/gtk_tut-5.html \
|
||||
html/gtk_tut-6.html \
|
||||
html/gtk_tut-7.html \
|
||||
html/gtk_tut-8.html \
|
||||
html/gtk_tut-9.html \
|
||||
html/gtk_tut-10.html \
|
||||
html/gtk_tut-11.html \
|
||||
html/gtk_tut-12.html \
|
||||
html/gtk_tut-13.html \
|
||||
html/gtk_tut-14.html \
|
||||
html/gtk_tut-15.html \
|
||||
html/gtk_tut-16.html \
|
||||
html/gtk_tut-17.html \
|
||||
html/gtk_tut-18.html \
|
||||
html/gtk_tut-19.html \
|
||||
html/gtk_tut-20.html \
|
||||
html/gtk_tut-21.html \
|
||||
html/gtk_tut-22.html \
|
||||
html/gtk_tut-23.html \
|
||||
html/gtk_tut-24.html \
|
||||
html/gtk_tut-25.html \
|
||||
html/gtk_tut-26.html \
|
||||
html/gtk_tut-27.html \
|
||||
html/gtk_tut-28.html \
|
||||
html/gtk_tut-29.html \
|
||||
html/gtk_tut-30.html \
|
||||
html/gtk_tut-31.html
|
||||
|
||||
TUTORIAL_IT_FILES= html/gtk_tut_it.html \
|
||||
html/gtk_tut_it-1.html \
|
||||
html/gtk_tut_it-2.html \
|
||||
html/gtk_tut_it-3.html \
|
||||
html/gtk_tut_it-4.html \
|
||||
html/gtk_tut_it-5.html \
|
||||
html/gtk_tut_it-6.html \
|
||||
html/gtk_tut_it-7.html \
|
||||
html/gtk_tut_it-8.html \
|
||||
html/gtk_tut_it-9.html \
|
||||
html/gtk_tut_it-10.html \
|
||||
html/gtk_tut_it-11.html \
|
||||
html/gtk_tut_it-12.html \
|
||||
html/gtk_tut_it-13.html \
|
||||
html/gtk_tut_it-14.html \
|
||||
html/gtk_tut_it-15.html \
|
||||
html/gtk_tut_it-16.html \
|
||||
html/gtk_tut_it-17.html \
|
||||
html/gtk_tut_it-18.html \
|
||||
html/gtk_tut_it-19.html \
|
||||
html/gtk_tut_it-20.html \
|
||||
html/gtk_tut_it-21.html \
|
||||
html/gtk_tut_it-22.html \
|
||||
html/gtk_tut_it-23.html \
|
||||
html/gtk_tut_it-24.html \
|
||||
text/gtk_tut_it.txt
|
||||
|
||||
FAQ_FILES=html/gtkfaq.html \
|
||||
html/gtkfaq-1.html \
|
||||
html/gtkfaq-2.html \
|
||||
html/gtkfaq-3.html \
|
||||
html/gtkfaq-4.html \
|
||||
html/gtkfaq-5.html \
|
||||
html/gtkfaq-6.html \
|
||||
html/gtkfaq-7.html \
|
||||
text/gtkfaq.txt
|
||||
|
||||
html/gtk_tut_table.gif: gdk.html gtk.html
|
||||
|
||||
.PHONY: html htmldir faq tutorial tutorial_it tutorial_fr files
|
||||
|
||||
distdocs: gdk.html gtk.html faq tutorial tutorial_it tutorial_fr
|
||||
|
||||
htmldir:
|
||||
(cd $(srcdir); mkdir -p html; cp gtk_tut*gif html)
|
||||
|
||||
textdir:
|
||||
mkdir -p $(srcdir)/text
|
||||
|
||||
gdk.html gdk_toc.html: gdk.texi
|
||||
(cd $(srcdir); texi2html gdk.texi)
|
||||
|
||||
gtk.html gtk_toc.html: gtk.texi
|
||||
(cd $(srcdir); texi2html gtk.texi)
|
||||
|
||||
html/gdk.html html/gdk_toc.html: htmldir gdk.html gdk_toc.html
|
||||
(cd $(srcdir); cp gdk.html gdk_toc.html html/)
|
||||
|
||||
html/gtk.html html/gtk_toc.html: htmldir gtk.html gtk_toc.html
|
||||
(cd $(srcdir); cp gtk.html gtk_toc.html html/)
|
||||
|
||||
$(FAQ_FILES): faq
|
||||
|
||||
faq: htmldir textdir
|
||||
(cd $(srcdir); sgml2html gtkfaq.sgml; \
|
||||
perl gtkdocs_fix gtkfaq*html; \
|
||||
mv gtkfaq*html html/; \
|
||||
sgml2txt gtkfaq.sgml; \
|
||||
mv gtkfaq.txt text/)
|
||||
|
||||
$(TUTORIAL_FILES): tutorial
|
||||
|
||||
$(TUTORIAL_FR_FILES): tutorial_fr
|
||||
|
||||
$(TUTORIAL_IT_FILES): tutorial_it
|
||||
|
||||
tutorial: htmldir textdir
|
||||
(cd $(srcdir); sgml2html gtk_tut.sgml; \
|
||||
perl gtkdocs_fix gtk_tut*html; \
|
||||
mv gtk_tut*html html/; \
|
||||
sgml2txt gtk_tut.sgml; \
|
||||
mv gtk_tut.txt text/)
|
||||
|
||||
tutorial_it: htmldir textdir
|
||||
(cd $(srcdir); sgml2html --language=it gtk_tut_it.sgml; \
|
||||
perl gtkdocs_fix gtk_tut_it*html; \
|
||||
mv gtk_tut_it*html html/; \
|
||||
sgml2txt --language=it gtk_tut_it.sgml; \
|
||||
mv gtk_tut_it.txt text/)
|
||||
|
||||
tutorial_fr: htmldir textdir
|
||||
(cd $(srcdir); sgml2html --language=fr gtk_tut_fr.sgml; \
|
||||
perl gtkdocs_fix gtk_tut_fr*html; \
|
||||
mv gtk_tut_fr*html html/; \
|
||||
sgml2txt --language=fr gtk_tut_fr.sgml; \
|
||||
mv gtk_tut_fr.txt text/)
|
||||
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
|
||||
EXTRA_DIST += \
|
||||
Changes-1.2.txt \
|
||||
Changes-2.0.txt \
|
||||
debugging.txt \
|
||||
defsformat.txt \
|
||||
developers.txt \
|
||||
dnd_internals.txt \
|
||||
make-todo \
|
||||
refcounting.txt \
|
||||
styles.txt \
|
||||
text_widget.txt \
|
||||
widget_system.txt \
|
||||
generation.txt \
|
||||
README.linux-fb \
|
||||
gtk-config.txt \
|
||||
gtk-config.1.in \
|
||||
gtkdocs_fix
|
||||
|
||||
texinfo.tex \
|
||||
macros.texi \
|
||||
gtkdocs_fix \
|
||||
gtkfaq.sgml \
|
||||
gtk_tut.sgml \
|
||||
gtk_tut_it.sgml \
|
||||
gtk_tut_fr.sgml \
|
||||
gtk_tut_packbox1.gif \
|
||||
gtk_tut_packbox2.gif \
|
||||
html/gtk_tut_table.gif \
|
||||
html/gtk_tut_packbox1.gif \
|
||||
html/gtk_tut_packbox2.gif \
|
||||
gtk_tut_table.gif \
|
||||
html/gdk.html \
|
||||
html/gdk_toc.html \
|
||||
html/gtk.html \
|
||||
html/gtk_toc.html \
|
||||
$(TUTORIAL_FILES) \
|
||||
$(TUTORIAL_FR_FILES) \
|
||||
$(TUTORIAL_IT_FILES) \
|
||||
$(FAQ_FILES)
|
||||
|
@@ -1,142 +0,0 @@
|
||||
About GtkFB:
|
||||
------------
|
||||
The linux-fb port of Gtk+, also known as GtkFB is an implementation of
|
||||
gdk (and therefor gtk) that runs on the linux framebuffer. It runs in
|
||||
a single process that doesn't need X. It should run most Gtk+ programs
|
||||
without any changes to the source.
|
||||
|
||||
Build requirements:
|
||||
-------------------
|
||||
To run GtkFB programs you will need glib, pango and gtk from cvs
|
||||
HEAD. Make sure you update these at the same time, since changes to
|
||||
glib and pango often forces changes in gtk+. Pango optionally depends
|
||||
on libfribidi, but for normal GtkFB usage that can be ignored.
|
||||
|
||||
You also need freetype 2, I recommend that you use freetype 2.0.1 or
|
||||
later, as there was some problems with freetype-config in 2.0.
|
||||
Freetype can be found at ftp://ftp.freetype.org
|
||||
|
||||
Hardware requirements:
|
||||
----------------------
|
||||
You need a graphics card with an availible framebuffer driver that can
|
||||
run in 8, 16, 24 or 32 bpp. I use the matroxfb driver, but i.e. vesafb
|
||||
should work too. You also need a supported mouse. Currently supported
|
||||
is ps2 mouse, ms serial mouse and fidmour touchscreen.
|
||||
|
||||
Building and installing:
|
||||
------------------------
|
||||
First build and install glib and pango as usual, in that order.
|
||||
|
||||
Then configure Gtk by running configure (or autogen.sh if running from
|
||||
cvs) with --with-gdktarget=linux-fb.
|
||||
|
||||
Make sure that pango and gtk+ are installed in the same prefix, as
|
||||
gtk+ installs a new pango module that pango must be able to find.
|
||||
|
||||
Then compile as ususal: make; make install
|
||||
|
||||
This installs a new pango module that pango must be instructed to
|
||||
find. This is done by running something like:
|
||||
pango-querymodules > /your_prefix/etc/pango/pango.modules
|
||||
(look at this file and make sure it contains a row with fb-basic.so.
|
||||
|
||||
Fonts:
|
||||
------
|
||||
Since GtkFB uses freetype 2 to render fonts it can render truetype and
|
||||
postscript type 1 antialiased fonts. At startup it scans these
|
||||
directories looking for any fonts:
|
||||
/usr/share/fonts/default/TrueType
|
||||
/usr/share/fonts/default/Type1
|
||||
/usr/lib/X11/fonts/TrueType
|
||||
/usr/lib/X11/fonts/Type1
|
||||
$(prefix)/share/fonts
|
||||
|
||||
It also has a hardcoded font alias handling. This is important because
|
||||
most program refers to the standard fonts by the names "Sans", "Serif"
|
||||
and "Monotype". The default aliases in GtkFB maps these to the
|
||||
M$ truetype fonts: Arial, Times New Roman, and Courier New (you need
|
||||
to own a copy of Windows to use these) and the type1 fonts URW Gothic,
|
||||
URW Bookman and Courier. You will need to have at least Arial or URW
|
||||
Gothic installed, because the "Sans" font is used as a last case font.
|
||||
|
||||
If you've done all this and fonts still doesn't work, make sure you've
|
||||
run pango-querymodules as described in the building and installing
|
||||
section.
|
||||
|
||||
Running:
|
||||
--------
|
||||
To run a program you should only need to start it, but there are some
|
||||
things that can cause problems, and some things that can be controlled
|
||||
by environment variables. Try testgtk distributed with gtk+ to test
|
||||
if things work.
|
||||
|
||||
If you use a ps2 mouse, make sure that /dev/psaux is readable and
|
||||
writable.
|
||||
|
||||
Make sure gpm is not running.
|
||||
|
||||
If you don't specify anything GtkFB will start up in the current
|
||||
virtual console in the current resolution and bit-depth. This can be
|
||||
changed by specifying environment variables:
|
||||
|
||||
GDK_VT:
|
||||
unset means open on the current VT.
|
||||
0-9: open on the specified VT. Make sure you have read/write rights
|
||||
there.
|
||||
new: Allocate a new VT after the last currently used one.
|
||||
|
||||
GDK_DISPLAY_MODE:
|
||||
Specifies the name of a mode in /etc/fb.modes that you want to use.
|
||||
|
||||
GDK_DISPLAY_DEPTH:
|
||||
Specify the desired bit depth of the framebuffer.
|
||||
|
||||
GDK_DISPLAY_WIDTH:
|
||||
Specify the desired width of the framebuffer.
|
||||
|
||||
GDK_DISPLAY_HEIGHT:
|
||||
Specify the desired height of the framebuffer.
|
||||
|
||||
GDK_DISPLAY:
|
||||
Specify the framebuffer device to use. Default is /dev/fb0
|
||||
|
||||
GDK_MOUSE_TYPE:
|
||||
Specify mouse type. Currently supported is:
|
||||
ps2 - PS/2 mouse
|
||||
imps2 - PS/2 intellimouse (wheelmouse)
|
||||
ms - Microsoft serial mouse
|
||||
fidmour - touch screen
|
||||
Default is ps2.
|
||||
|
||||
GDK_KEYBOARD_TYPE:
|
||||
Specify keyboard type. Currently suppored is
|
||||
xlate - normal tty mode keyboard.
|
||||
Quite limited, cannot detect key up/key down events. Doesn't
|
||||
handle ctrl/alt/shift for all keys. This is the default driver,
|
||||
but should not be used in "production" use.
|
||||
raw - read from the tty in RAW mode.
|
||||
Sets the keyboard in RAW mode and handles all the keycodes. This
|
||||
gives correct handling of modifiers and key up/down events. You
|
||||
must be root to use this. If you use this for development or
|
||||
debugging it is recommended to enable magic sysrq handling in the
|
||||
kernel. Then you can use ALT-SysRQ-r to turn the keyboard back to
|
||||
normal mode.
|
||||
Default is xlate.
|
||||
|
||||
HACKING:
|
||||
--------
|
||||
|
||||
Pressing Ctrl-Alt-Return repaints the whole screen.
|
||||
Unfortunately this cannot be pressed when using the xlate keyboard
|
||||
driver, so instead you can use shift-F1 instead when using this
|
||||
driver.
|
||||
|
||||
Pressing Ctrl-Alt-BackSpace kills the GtkFB program. (Can't be pressed
|
||||
in the xlate driver.
|
||||
|
||||
More to be written.
|
||||
|
||||
- Alexander Larsson <alexl@redhat.com>
|
||||
2000/12/06
|
||||
|
||||
|
@@ -1,338 +0,0 @@
|
||||
|
||||
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))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,19 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.html
|
||||
*.dvi
|
||||
*.ps
|
||||
*.pg
|
||||
*.ky
|
||||
*.cp
|
||||
*.fn
|
||||
*.tp
|
||||
*.vr
|
||||
*.log
|
||||
*.aux
|
||||
*.toc
|
||||
*.cps
|
||||
*.fns
|
||||
*.vrs
|
||||
html
|
||||
text
|
@@ -1,42 +0,0 @@
|
||||
.PHONY: htmldir textdir faq
|
||||
|
||||
FAQ_FILES=html/gtkfaq.html \
|
||||
html/gtkfaq-1.html \
|
||||
html/gtkfaq-2.html \
|
||||
html/gtkfaq-3.html \
|
||||
html/gtkfaq-4.html \
|
||||
html/gtkfaq-5.html \
|
||||
html/gtkfaq-6.html \
|
||||
html/gtkfaq-7.html \
|
||||
text/gtkfaq.txt
|
||||
|
||||
$(FAQ_FILES): faq
|
||||
|
||||
htmldir:
|
||||
mkdir -p $(srcdir)/html
|
||||
|
||||
textdir:
|
||||
mkdir -p $(srcdir)/text
|
||||
|
||||
faq: htmldir textdir
|
||||
(cd $(srcdir); sgml2html gtkfaq.sgml; \
|
||||
perl $(top_srcdir)/docs/gtkdocs_fix gtkfaq*html; \
|
||||
mv gtkfaq*html html/; \
|
||||
sgml2txt gtkfaq.sgml; \
|
||||
mv gtkfaq.txt text/)
|
||||
|
||||
EXTRA_DIST += gtkfaq.sgml gtk-faq.sgml
|
||||
|
||||
if HAVE_SGML2HTML
|
||||
dist-hook: faq
|
||||
mkdir $(distdir)/html
|
||||
cp -p $(srcdir)/html/*.html $(distdir)/html
|
||||
mkdir $(distdir)/text
|
||||
cp -p $(srcdir)/text/*.txt $(distdir)/text
|
||||
else
|
||||
dist-hook:
|
||||
echo "***"
|
||||
echo "*** Warning: FAQ not built"
|
||||
echo "*** DISTRIBUTION IS INCOMPLETE"
|
||||
echo "***"
|
||||
endif
|
@@ -1617,7 +1617,7 @@ placed on a queue, which is processed within <tt/gtk_main()/. You can
|
||||
force the drawing queue to be processed using something like:
|
||||
|
||||
<tscreen><verb>
|
||||
while (g_main_iteration(FALSE));
|
||||
while (gtk_main_iteration(FALSE));
|
||||
</verb></tscreen>
|
||||
|
||||
inside you're function that changes the widget.
|
||||
|
198
docs/gdk.sgml
Normal file
@@ -0,0 +1,198 @@
|
||||
<!doctype linuxdoc system>
|
||||
|
||||
<article>
|
||||
|
||||
<!-- Title information -->
|
||||
|
||||
<title>The GTK+ Drawing Kit Programming Manual
|
||||
<author>Shawn T. Amundson, Peter Mattis
|
||||
<date>July 26, 1998
|
||||
|
||||
<abstract>
|
||||
This document aims at teaching user how to effectively program in
|
||||
GDK, the GTK+ Drawing Kit, and to serve as a reference guide to
|
||||
more experienced GTK+ programmers. It is a work in progress.
|
||||
|
||||
<!-- Table of contents -->
|
||||
<toc>
|
||||
|
||||
<!-- Begin the document -->
|
||||
|
||||
<!-- ***************************************************************** -->
|
||||
<sect>Introduction
|
||||
|
||||
<p>
|
||||
GDK is designed as a wrapper library that lies on top of Xlib. It
|
||||
performs many common and desired operations for a programmer instead
|
||||
of the programmer having to explicitly ask for such functionality from
|
||||
Xlib directly. For example, GDK provides a common interface to both
|
||||
regular and shared memory XImage types. By doing so, an application
|
||||
can nearly transparently use the fastest image type available. GDK
|
||||
also provides routines for determining the best available color depth
|
||||
and the best available visual which is not always the default visual
|
||||
for a screen.
|
||||
|
||||
GDK is distributed and developed with GTK+, and is licensed under the
|
||||
GNU Library General Public Licence (LGPL).
|
||||
|
||||
<sect>Getting Started
|
||||
|
||||
<sect1>Initialization
|
||||
<p>
|
||||
Initialization of GDK is easy. Simply call gdk_init() passing
|
||||
in the argc and argv parameters.
|
||||
|
||||
<tscreen><verb>
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
/* Initialize GDK. */
|
||||
gdk_init (&argc, &argv);
|
||||
|
||||
/* Cleanup of GDK is done automatically when the program exits. */
|
||||
return 0;
|
||||
}
|
||||
</verb></tscreen>
|
||||
|
||||
Generally, GDK initialization is done by gtk_init() in GTK+. This means
|
||||
that when using GTK+, you do not need to directly call gdk_init().
|
||||
|
||||
<sect1>An Example using GDK with GTK+
|
||||
<p>
|
||||
This example demonstrates drawing a line using the foreground
|
||||
color of the GtkDrawArea widget it is drawn inside. The example
|
||||
will end when you click inside the window, which is filled by the
|
||||
GtkDrawingArea widget.
|
||||
|
||||
The line is drawn during the expose event so that when the window
|
||||
drawing is done whenever it is needed.
|
||||
|
||||
<tscreen><verb>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* The expose callback does the drawing of the line */
|
||||
int
|
||||
expose_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
GdkGC *gc;
|
||||
|
||||
printf("expose...\n");
|
||||
|
||||
|
||||
/* The GC is the Graphics Context. Here it is borrowed from the widget */
|
||||
gc = widget->style->fg_gc[GTK_STATE_NORMAL];
|
||||
|
||||
gdk_draw_line (widget->window, /* GDK Window of GtkDrawingArea widget */
|
||||
gc, /* Graphics Context */
|
||||
0, /* x1, left */
|
||||
0, /* y1, top */
|
||||
200, /* x2, right */
|
||||
200); /* y2, bottom */
|
||||
}
|
||||
|
||||
/* This quits GTK+ */
|
||||
void destroy (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *darea;
|
||||
int events;
|
||||
|
||||
/* This initializes both GTK+ and GDK */
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* Create a window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
|
||||
/* Create a drawing area widget. This widget actually is just a
|
||||
simple widget which provides us an GDK window to draw on and
|
||||
takes care of all the toolkit integration, like providing the
|
||||
ability to add it to the window with gtk_contianer_add() */
|
||||
darea = gtk_drawing_area_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), darea);
|
||||
|
||||
/* Set the width and height (arguments are in that order) */
|
||||
gtk_drawing_area_size (GTK_DRAWING_AREA (darea), 200, 200);
|
||||
|
||||
/* Drawing in the expose event is important to keep the
|
||||
draw line always on the GDK window */
|
||||
gtk_signal_connect (GTK_OBJECT (darea), "expose_event",
|
||||
GTK_SIGNAL_FUNC (expose_callback), NULL);
|
||||
|
||||
/* We get the events, then add in button press. If we did not
|
||||
do this, we would not be notified of button press events in
|
||||
the GtkDrawingArea widget */
|
||||
events = gtk_widget_get_events (darea);
|
||||
gtk_widget_set_events (darea, events | GDK_BUTTON_PRESS_MASK);
|
||||
|
||||
/* If we click on the darea, the application will exit */
|
||||
gtk_signal_connect_object (GTK_OBJECT (darea), "button_press_event",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
|
||||
gtk_widget_show (darea);
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* The GTK+ main idle loop */
|
||||
gtk_main();
|
||||
|
||||
/* Cleanup of GDK is done automatically when the program exits. */
|
||||
return 0;
|
||||
}
|
||||
</verb></tscreen>
|
||||
|
||||
<sect>The Graphics Context
|
||||
<p>
|
||||
The Graphics Context, or GC, defines how things should be drawn,
|
||||
including color, font, fill, tile, stipple, clipping mask, line
|
||||
width, line style, and join style.
|
||||
|
||||
<sect1>Color
|
||||
<p>
|
||||
Changing color is done by changing the forground or background color
|
||||
of the GC.
|
||||
|
||||
<sect>Drawing Commands
|
||||
<sect>Event Handling
|
||||
<sect>Understanding and Using Visuals
|
||||
<sect>Creating and Using New Windows
|
||||
<sect>Pixmaps
|
||||
<sect>Images
|
||||
<sect>Fonts
|
||||
<sect>
|
||||
|
||||
<sect>About this Document
|
||||
<sect1>History
|
||||
<P>
|
||||
This document was originially written by Peter Mattis and entitled
|
||||
"The General Drawing Kit". It was meant as a reference guide.
|
||||
|
||||
This version of the document has been renamed and is meant as a general
|
||||
programming guide.
|
||||
|
||||
<sect1>Copying
|
||||
<p>
|
||||
Copyright (c) 1996 Peter Mattis
|
||||
<p>
|
||||
Copyright (c) 1998 Shawn T. Amundson
|
||||
|
||||
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.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation
|
||||
approved by Peter Mattis.
|
||||
|
||||
</article>
|
334
docs/gdk.texi
Normal file
@@ -0,0 +1,334 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c %**start of header
|
||||
@setfilename gdk.info
|
||||
@settitle GDK
|
||||
@setchapternewpage odd
|
||||
@c %**end of header
|
||||
|
||||
@set edition 1.0
|
||||
@set update-date 16 May 1996
|
||||
@set update-month May 1996
|
||||
|
||||
@ifinfo
|
||||
This file documents GDK, the General Drawing Kit
|
||||
|
||||
Copyright (C) 1996 Peter Mattis
|
||||
|
||||
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
|
||||
|
||||
@ignore
|
||||
Permission is granted to process this file throught TeX and print the
|
||||
results, provided the printed document carries copying permission notice
|
||||
identical to this one except for the removal of this paragraph (this
|
||||
paragraph not being relevant to the printed manual).
|
||||
|
||||
@end ignore
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation
|
||||
approved by Peter Mattis.
|
||||
@end ifinfo
|
||||
|
||||
@titlepage
|
||||
@title The General Drawing Kit
|
||||
@subtitle Version 1.0
|
||||
@subtitle @value{update-month}
|
||||
@author by Peter Mattis
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
Copyright @copyright{} 1996 Peter Mattis
|
||||
|
||||
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.
|
||||
|
||||
Permission is granted to copy and distribute modified versions of this
|
||||
manual under the conditions for verbatim copying, provided that the
|
||||
entire resulting derived work is distributed under the terms of a
|
||||
permission notice identical to this one.
|
||||
|
||||
Permission is granted to copy and distribute translations of this manual
|
||||
into another language, under the above conditions for modified versions,
|
||||
except that this permission notice may be stated in a translation
|
||||
approved by Peter Mattis.
|
||||
@end titlepage
|
||||
|
||||
@dircategory User Interface Toolkit
|
||||
@direntry
|
||||
* GDK: (gdk). The General Drawing Kit
|
||||
@end direntry
|
||||
|
||||
@node Top, Copying, (dir), (dir)
|
||||
@top The General Drawing Kit
|
||||
@ifinfo
|
||||
This is edition @value{edition} of the GDK documentation,
|
||||
@w{@value{update-date}}.
|
||||
@end ifinfo
|
||||
|
||||
@menu
|
||||
* Copying:: Your rights.
|
||||
* Overview:: What is GDK?
|
||||
* Initialization:: Initialization and exit.
|
||||
* Events:: Event handling.
|
||||
* Visuals:: Understanding and using visuals.
|
||||
* Windows:: Creating and using windows.
|
||||
* Graphics Contexts:: Creating and modifying GCs.
|
||||
* Pixmaps:: Creating pixmaps.
|
||||
* Images:: Creating images.
|
||||
* Color:: Specifying color.
|
||||
* Fonts:: Creating fonts.
|
||||
* Drawing:: Drawing commands.
|
||||
* XInput Support:: Using extended devices.
|
||||
* Miscellany:: Other stuff.
|
||||
* Examples:: Using GDK.
|
||||
* Function Index:: Index of functions
|
||||
* Concept Index:: Index of concepts
|
||||
@end menu
|
||||
|
||||
@node Copying, Overview, Top, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Copying
|
||||
|
||||
GDK is @dfn{free}; this means that everyone is free to use it and free
|
||||
to redestribute it on a free basis. GDK is not in the public domain; it
|
||||
is copyrighted and there are restrictions on its distribution, but these
|
||||
restrictions are designed to permit everything that a good cooperating
|
||||
citizen would want to do. What is not allowed is to try to prevent
|
||||
others from further sharing any version of GDK that they might get from
|
||||
you.
|
||||
|
||||
Specifically, we want to make sure that you have the right to give away
|
||||
copies of GDK, that you receive source code or else can get it if you
|
||||
want it, that you can change GDK or use pieces of it in new free
|
||||
programs, and that you know you can do these things.
|
||||
|
||||
To make sure that everyone has such rights, we have to forbid you to
|
||||
deprive anyone else of these rights. For example, if you distribute
|
||||
copies of GDK, you must give the recipients all the rights that you
|
||||
have. You must make sure that they, too, receive or can get the source
|
||||
code. And you must tell them their rights.
|
||||
|
||||
Also, for my own protection, we must make certain that everyone finds
|
||||
out that there is no warranty for GDK. If GDK is modified by someone
|
||||
else and passed on, we want their recipients to know that what they have
|
||||
is not what we distributed, so that any problems introduced by others
|
||||
will no reflect on our reputation.
|
||||
|
||||
The precise conditions of the licenses for GDK are found in the General
|
||||
Public Licenses that accompanies it.
|
||||
|
||||
|
||||
@node Overview, Initialization, Copying, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter What is GDK?
|
||||
@cindex Overview
|
||||
|
||||
GDK is designed as a wrapper library that lies on top of Xlib. It
|
||||
performs many common and desired operations for a programmer instead
|
||||
of the programmer having to explicitly ask for such functionality from
|
||||
Xlib directly. For example, GDK provides a common interface to both
|
||||
regular and shared memory XImage types. By doing so, an application
|
||||
can nearly transparently use the fastest image type available. GDK
|
||||
also provides routines for determining the best available color depth
|
||||
and the best available visual which is not always the default visual
|
||||
for a screen.
|
||||
|
||||
@node Initialization, Events, Overview, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Initialization and exit
|
||||
@cindex Initialization
|
||||
@cindex Exit
|
||||
|
||||
Initializing GDK is easy. Simply call @code{gdk_init} passing in the
|
||||
@var{argc} and @var{argv} parameters. Exit is similarly easy. Just
|
||||
call @code{gdk_exit}.
|
||||
|
||||
@deftypefun void gdk_init (int *@var{argc}, char ***@var{argv})
|
||||
Initializes the GDK library. The arguments @var{argc} and @var{argv}
|
||||
are scanned and any arguments that GDK recognizes are handled and
|
||||
removed. The @var{argc} and @var{argv} parameters are the values
|
||||
passed to @code{main} upon program invocation.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gdk_exit (int @var{errorcode})
|
||||
Exit GDK and perform any necessary cleanup. @code{gdk_exit} will call
|
||||
the systems @code{exit} function passing @var{errorcode} as the
|
||||
parameter.
|
||||
@end deftypefun
|
||||
|
||||
@example
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
@{
|
||||
/* Initialize GDK. */
|
||||
gdk_init (&argc, &argv);
|
||||
|
||||
/* Exit from GDK...this call will never return. */
|
||||
gdk_exit (0);
|
||||
|
||||
/* Keep compiler from issuing a warning */
|
||||
return 0;
|
||||
@}
|
||||
@end example
|
||||
|
||||
|
||||
@node Events, Visuals, Initialization, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Event handling
|
||||
@cindex Events
|
||||
|
||||
Events are the means by which GDK lets the programmer know of user
|
||||
interaction. An event is normally a button or key press or some other
|
||||
indirect user action, such as a the mouse cursor entering or leaving a
|
||||
window.
|
||||
|
||||
There exist only a few functions for getting events and event
|
||||
information. These are @code{gdk_events_pending},
|
||||
@code{gdk_event_get}, @code{gdk_events_record} and
|
||||
@code{gdk_events_playback}. The latter two functions are useful for
|
||||
automatic testing of a software package and should normally not be
|
||||
needed in a program.
|
||||
|
||||
@deftypefun gint gdk_events_pending (void)
|
||||
Returns the number of events pending on the event queue.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gint gdk_event_get (GdkEvent *@var{event})
|
||||
Return the next available event in the @var{event}
|
||||
structure. @code{gdk_event_get} will return @code{TRUE} on success and
|
||||
@code{FALSE} on failure. Success and failure is determined by whether
|
||||
an event arrived before the timeout period expired.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gdk_events_record (char *@var{filename})
|
||||
Turn on recording of events. User events and certain system events will
|
||||
be saved in the file named by the variable @var{filename}. This stream
|
||||
of events can later be played back and ``should'' produce the same
|
||||
results as when the original events were handled. However, the
|
||||
programmer does need to be careful in that the state of the program must
|
||||
be the same when @code{gdk_events_record} is called and when
|
||||
@code{gdk_events_playback} is called. For this reason,
|
||||
@code{gdk_events_record} is normally not called directly, but is instead
|
||||
invoked indirectly by specifying the ``-record'' command line option.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gdk_events_playback (char *@var{filename})
|
||||
Start playback of events from a file. (See the above description of
|
||||
@code{gdk_events_record}). Normally this function is not called directly
|
||||
but is invoked by the ``-playback'' command line option.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gdk_events_stop (void)
|
||||
Stop recording and playback of events.
|
||||
@end deftypefun
|
||||
|
||||
@example
|
||||
void
|
||||
handle_event ()
|
||||
@{
|
||||
GdkEvent event;
|
||||
|
||||
if (gdk_event_get (&event))
|
||||
@{
|
||||
switch (event.type)
|
||||
@{
|
||||
@dots{}
|
||||
@}
|
||||
@}
|
||||
@}
|
||||
@end example
|
||||
|
||||
|
||||
@node Visuals, Windows, Events, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Understanding and using visuals
|
||||
@cindex Visuals
|
||||
|
||||
@node Windows, Graphics Contexts, Visuals, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating and using windows
|
||||
@cindex Windows
|
||||
|
||||
@node Graphics Contexts, Pixmaps, Windows, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating and modifying GCs
|
||||
@cindex Graphics Contexts
|
||||
@cindex GC
|
||||
|
||||
@node Pixmaps, Images, Graphics Contexts, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating pixmaps
|
||||
@cindex Pixmaps
|
||||
|
||||
@node Images, Color, Pixmaps, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating images
|
||||
@cindex Images
|
||||
|
||||
@node Color, Fonts, Images, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Specifying color
|
||||
@cindex Color
|
||||
|
||||
@node Fonts, Drawing, Color, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Creating Fonts
|
||||
@cindex Fonts
|
||||
|
||||
@node Drawing, XInput Support, Fonts, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Drawing Commands
|
||||
@cindex Drawing
|
||||
|
||||
@node XInput Support, Miscellany, Drawing, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Using extended devices
|
||||
@cindex Overview
|
||||
@cindex Using extended device capabilities
|
||||
@cindex Controlling extended devices
|
||||
|
||||
@node Miscellany, Examples, XInput Support, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Other stuff
|
||||
@cindex Timers
|
||||
@cindex Debugging
|
||||
@cindex Miscellaneous
|
||||
|
||||
|
||||
@node Examples, Function Index, Miscellany, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Using GDK
|
||||
@cindex Examples
|
||||
|
||||
|
||||
@node Function Index, Concept Index, Examples, Top
|
||||
@comment node-name, next, previous, up
|
||||
@unnumbered Variable Index
|
||||
|
||||
@printindex fn
|
||||
|
||||
@node Concept Index, , Function Index, Top
|
||||
@comment node-name, next, previous, up
|
||||
@unnumbered Concept Index
|
||||
|
||||
@printindex cp
|
||||
|
||||
@summarycontents
|
||||
@contents
|
||||
@bye
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
5648
docs/gtk.texi
Normal file
10261
docs/tutorial/gtk-tut.sgml → docs/gtk_tut.sgml
Executable file → Normal file
8600
docs/gtk_tut_fr.sgml
Normal file
10090
docs/gtk_tut_it.sgml
Normal file
BIN
docs/gtk_tut_packbox1.gif
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
docs/gtk_tut_packbox2.gif
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
docs/gtk_tut_table.gif
Normal file
After Width: | Height: | Size: 2.4 KiB |
2982
docs/gtkfaq.sgml
Normal file
18
docs/macros.texi
Normal file
@@ -0,0 +1,18 @@
|
||||
@macro gtkstdmacros {p, q}
|
||||
|
||||
@deftypefun Gtk\p\* GTK_\q\ (gpointer @var{obj})
|
||||
Cast a generic pointer to @code{Gtk\p\*}. @xref{Standard Macros}, for
|
||||
more info.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun Gtk\p\Class* GTK_\q\_CLASS (gpointer @var{class})
|
||||
Cast a generic pointer to @code{Gtk\p\Class*}. @xref{Standard Macros},
|
||||
for more info.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gint GTK_IS_\q\ (gpointer @var{obj})
|
||||
Determine if a generic pointer refers to a @code{Gtk\p\}
|
||||
object. @xref{Standard Macros}, for more info.
|
||||
@end deftypefun
|
||||
|
||||
@end macro
|
@@ -196,7 +196,7 @@ class TodoParser (xmllib.XMLParser):
|
||||
|
||||
def start_contact(self,attributes):
|
||||
if not self.entry:
|
||||
raise ParseError, "<contact> tag must be in <entry>"
|
||||
raise ParseError, "<contact> tag must be in <contact>"
|
||||
if self.in_data:
|
||||
raise ParseError, "Unexpected <contact> tag in content"
|
||||
self.in_data = 1
|
||||
|
242
docs/man/gtk_button.pod
Normal file
@@ -0,0 +1,242 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
gtk_button - GTK+ push button widget
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <gtk/gtkbutton.h>
|
||||
|
||||
GtkType gtk_button_get_type (void);
|
||||
GtkWidget* gtk_button_new (void);
|
||||
GtkWidget* gtk_button_new_with_label (const gchar *label);
|
||||
void gtk_button_pressed (GtkButton *button);
|
||||
void gtk_button_released (GtkButton *button);
|
||||
void gtk_button_clicked (GtkButton *button);
|
||||
void gtk_button_enter (GtkButton *button);
|
||||
void gtk_button_leave (GtkButton *button);
|
||||
void gtk_button_set_relief (GtkButton *button,
|
||||
GtkReliefStyle style);
|
||||
GtkReliefStyle gtk_button_get_relief (GtkButton *button);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This widget is a standard push button widget. Push button widgets
|
||||
are generally used for allowing the user to click on them to initiate
|
||||
a command.
|
||||
|
||||
This widget is a container widget which contains one child.
|
||||
|
||||
=head1 OBJECT HIERARCHY
|
||||
|
||||
gtk_object
|
||||
gtk_widget
|
||||
gtk_container
|
||||
gtk_button
|
||||
|
||||
=head1 SIGNAL PROTOTYPES
|
||||
|
||||
"clicked" void user_function (GtkWidget *widget, gpointer data);
|
||||
"pressed" void user_function (GtkWidget *widget, gpointer data);
|
||||
"released" void user_function (GtkWidget *widget, gpointer data);
|
||||
"enter" void user_function (GtkWidget *widget, gpointer data);
|
||||
"leave" void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
=head2 Creation
|
||||
|
||||
The most common way to create a button is with a label in it, which
|
||||
contains text for the user to read. The child of the button will then
|
||||
be a L<gtk_label(3)> widget with the text you passwd in. You can
|
||||
do this in one command:
|
||||
|
||||
GtkWidget *button;
|
||||
button = gtk_button_new_with_label ("This is a button");
|
||||
|
||||
To create a gtk_button widget which does not already have a child,
|
||||
use gtk_button_new():
|
||||
|
||||
GtkWidget *button;
|
||||
button = gtk_button_new ();
|
||||
|
||||
After you have created a button you can then add a widget to the
|
||||
button (such as a label or pixmap) using gtk_container_add(). See
|
||||
L<gtk_container(3)> for more information on adding widgets to
|
||||
containers.
|
||||
|
||||
=head2 Creating a pixmap in a button in a window
|
||||
|
||||
After we have an empty gtk_button, such as above, and we have a gtk_pixmap,
|
||||
we can simply add the gtk_pixmap to the gtk_button with gtk_container_add().
|
||||
|
||||
The following code will open the file "gimp.xpm" and place it in a
|
||||
button.
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *pixmap;
|
||||
GtkStyle *style;
|
||||
GdkPixmap *gdkpixmap;
|
||||
GdkBitmap *mask;
|
||||
char *filename = "gimp.xpm";
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
|
||||
/* The button is realized now, which creates button->window
|
||||
used below to create the pixmap. */
|
||||
gtk_widget_realize (button);
|
||||
|
||||
style = gtk_widget_get_style (button);
|
||||
gdkpixmap = gdk_pixmap_create_from_xpm (button->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
filename);
|
||||
pixmap = gtk_pixmap_new (gdkpixmap, mask);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
=head2 Different reliefs
|
||||
|
||||
Reliefs affect how the shadowing of the button is drawn. The different
|
||||
types of relief styles are:
|
||||
|
||||
GTK_RELIEF_NORMAL
|
||||
GTK_RELIEF_HALF
|
||||
GTK_RELIEF_NONE
|
||||
|
||||
When set to a normal relief, the widget looks and acts like a normal
|
||||
button. When half or none relief is used, shadowing is only drawn when the
|
||||
mouse cursor is over the widget.
|
||||
|
||||
To set the relief, use gtk_button_set_relief(), like:
|
||||
|
||||
gtk_button_set_relief (button, GTK_RELIEF_HALF);
|
||||
|
||||
To get the current relief of a button, use gtk_button_get_relief():
|
||||
|
||||
GtkReliefStyle relief;
|
||||
relief = gtk_button_get_relief (GTK_BUTTON (button));
|
||||
|
||||
=head2 Executing a command when the button is pressed
|
||||
|
||||
To execute a function when a button is pressed, use
|
||||
gtk_signal_connect() to connect to the "clicked" signal.
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (user_function),
|
||||
NULL);
|
||||
|
||||
user_function is a user defined function, like the following:
|
||||
|
||||
void user_function (GtkWidget *button, gpointer data)
|
||||
{
|
||||
printf("clicked\n");
|
||||
}
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
GtkType gtk_button_get_type (void);
|
||||
|
||||
This function returns the GtkType which is assigned to the
|
||||
object class for gtk_button.
|
||||
|
||||
GtkWidget* gtk_button_new (void);
|
||||
|
||||
This functions returns a new button widget which can then be
|
||||
used as a container for another widget.
|
||||
|
||||
GtkWidget* gtk_button_new_with_label (const gchar *label);
|
||||
|
||||
This function returns a new button widget with a label widget
|
||||
as a child. The label widget will have the text passed into
|
||||
the commant.
|
||||
|
||||
void gtk_button_pressed (GtkButton *button);
|
||||
|
||||
This function sends a "pressed" signal to the button.
|
||||
|
||||
void gtk_button_released (GtkButton *button);
|
||||
|
||||
This function sends a "released" signal to the button.
|
||||
|
||||
void gtk_button_clicked (GtkButton *button);
|
||||
|
||||
This function sends a "clicked" signal to the button.
|
||||
|
||||
void gtk_button_enter (GtkButton *button);
|
||||
|
||||
This function sends a "enter" signal to the button.
|
||||
|
||||
void gtk_button_leave (GtkButton *button);
|
||||
|
||||
This function sends a "leave" signal to the button.
|
||||
|
||||
void gtk_button_set_relief (GtkButton *button, GtkReliefStyle style);
|
||||
|
||||
This function is sets the GtkReliefStyle of the button. The
|
||||
relief style is one of: GTK_RELIEF_NORMAL, GTK_RELIEF_HALF,
|
||||
or GTK_RELIEF_NONE. The relief determines when the shadow of
|
||||
the button is drawn.
|
||||
|
||||
GtkReliefStyle gtk_button_get_relief (GtkButton *button);
|
||||
|
||||
This function returns the current relief of the button.
|
||||
|
||||
=head1 SIGNALS
|
||||
|
||||
"clicked"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Gets emitted when the button is clicked. A click is
|
||||
a press and release of the button when the cursor is
|
||||
inside the button on release.
|
||||
|
||||
"pressed"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Gets emitted when the left mouse button is pressed.
|
||||
|
||||
"released"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Gets emitted when the left mouse button is released and
|
||||
the widget was previously pressed.
|
||||
|
||||
"enter"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Emitted when the mouse cursor enters the button.
|
||||
|
||||
"leave"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Emitted when the mouse cursor leaves the button.
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
The author of this man page is Shawn T. Amundson E<lt>amundson@gtk.orgE<gt>.
|
||||
For the authors of GTK+, see the AUTHORS file in the GTK+ distribution.
|
||||
|
||||
|
99
docs/package_tutorial.sh
Executable file
@@ -0,0 +1,99 @@
|
||||
#! /bin/sh
|
||||
# package_tutorial.sh - Package up the tutorial into various formats
|
||||
# Copyright (C) Tony Gale 1999
|
||||
# Contact: gale@gtk.org
|
||||
#
|
||||
# NOTE: This script requires the following to be installed:
|
||||
# o SGML Tools
|
||||
# o Latex
|
||||
# o DVI tools
|
||||
|
||||
TARGET=`pwd`/gtk_tut.sgml
|
||||
GIFS="`pwd`/*.gif"
|
||||
EXAMPLES=`pwd`/../examples
|
||||
|
||||
PATH=`pwd`:$PATH
|
||||
|
||||
DATE=`date '+%y%m%d'`
|
||||
|
||||
# Check top level directory
|
||||
if [ ! -d gtk_tutorial ]; then
|
||||
if [ -e gtk_tutorial ]; then
|
||||
echo "ERROR: gtk_tutorial is not a directory"
|
||||
exit
|
||||
fi
|
||||
mkdir gtk_tutorial.$DATE
|
||||
fi
|
||||
|
||||
cd gtk_tutorial.$DATE
|
||||
|
||||
# SGML Format
|
||||
echo -n "Copy SGML and GIF's.... "
|
||||
if [ ! -d sgml ]; then
|
||||
if [ -e sgml ]; then
|
||||
echo "ERROR: html is not a directory"
|
||||
exit
|
||||
fi
|
||||
mkdir sgml
|
||||
fi
|
||||
|
||||
(cd sgml ; cp $TARGET . ; cp $GIFS .)
|
||||
echo "done"
|
||||
|
||||
# HTML Format
|
||||
echo -n "Formatting into HTML.... "
|
||||
if [ ! -d html ]; then
|
||||
if [ -e html ]; then
|
||||
echo "ERROR: html is not a directory"
|
||||
exit
|
||||
fi
|
||||
mkdir html
|
||||
fi
|
||||
|
||||
(cd html ; sgml2html $TARGET ; cp $GIFS .)
|
||||
echo "done"
|
||||
|
||||
# Text Format
|
||||
echo -n "Formatting into Text.... "
|
||||
if [ ! -d txt ]; then
|
||||
if [ -e txt ]; then
|
||||
echo "ERROR: txt is not a directory"
|
||||
exit
|
||||
fi
|
||||
mkdir txt
|
||||
fi
|
||||
|
||||
(cd txt ; sgml2txt -f $TARGET 2>&1 > /dev/null )
|
||||
echo "done"
|
||||
|
||||
# PS and DVI Format
|
||||
echo -n "Formatting into PS and DVI.... "
|
||||
if [ ! -d ps ]; then
|
||||
if [ -e ps ]; then
|
||||
echo "ERROR: ps is not a directory"
|
||||
exit
|
||||
fi
|
||||
mkdir ps
|
||||
fi
|
||||
|
||||
(cd ps ; sgml2latex --output=ps $TARGET > /dev/null)
|
||||
(cd ps ; sgml2latex $TARGET > /dev/null)
|
||||
echo "done"
|
||||
|
||||
# Copy examples
|
||||
echo -n "Copying examples"
|
||||
cp -R $EXAMPLES .
|
||||
(cd examples ; make clean ; rm -rf CVS */CVS)
|
||||
echo "done"
|
||||
|
||||
# Package it all up
|
||||
echo -n "Creating packages.... "
|
||||
cd ..
|
||||
tar cvfz gtk_tutorial.$DATE.tar.gz gtk_tutorial.$DATE
|
||||
echo "done"
|
||||
|
||||
rm -rf gtk_tutorial.$DATE
|
||||
|
||||
echo
|
||||
echo Package gtk_tutorial.$DATE.tar.gz created.
|
||||
echo
|
@@ -1,2 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
@@ -1,115 +1,3 @@
|
||||
Wed Oct 25 15:19:40 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/tmpl/gtknotebook.sgml: Moved function docs into .c
|
||||
file, fairly extensive rewriting.
|
||||
|
||||
Thu Nov 30 00:53:45 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/tmpl/gtkfilesel.sgml: Fix to say that file_selection_complete()
|
||||
filters both files and directories.
|
||||
|
||||
* gtk/tmpl/gtktogglebutton.sgml: Fix description
|
||||
of gtk_toggle_button_toggled().
|
||||
|
||||
Fri Nov 17 17:31:30 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/Makefile.am (content_files): Add a couple
|
||||
of files.
|
||||
|
||||
Mon Nov 13 16:58:43 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* {gtk,gdk,gdk-pixbuf}/Makefile.am: cd to srcdir before
|
||||
calling gtkdoc-fixref, distribute index.sgml.
|
||||
|
||||
* gtk/gtk-docs.sgml gtk/Makefile.am gtk/gtk-sections.txt
|
||||
gtk/gtk.types: Update
|
||||
|
||||
2000-11-05 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gtk/tmpl/gtktexttag.sgml: documented some of the object args
|
||||
|
||||
* gtk/text_widget.sgml: fixups
|
||||
|
||||
2000-11-04 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gtk/gtk-sections.txt: Added a bunch of stuff from unused
|
||||
|
||||
2000-11-01 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/tmpl/gtkmessagedialog.sgml: Check in these docs, I seem to
|
||||
have written them a while ago then forgotten about them.
|
||||
|
||||
2000-11-01 Havoc Pennington <hp@pobox.com>
|
||||
|
||||
* gtk/gtk-sections.txt: Add new label functions
|
||||
|
||||
Sun Oct 29 02:59:50 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* **: Updates to new gtk-doc, gsignal, causing quite
|
||||
a bit of diffs but little real changes.
|
||||
|
||||
2000-10-24 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/text_widget.sgml: add note about UTF-8
|
||||
|
||||
2000-10-23 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtk-sections.txt: remove GtkTextBTree
|
||||
|
||||
* gtk/text_widget.sgml: Overview of the text widget
|
||||
|
||||
* gtk/gtk-docs.sgml: Change to using categories for the toplevel
|
||||
organization of the reference entries. We'll add an alphabetical
|
||||
index eventually. The category way is a lot easier for people who
|
||||
aren't familiar with the widgets. Removed objects_grouped.sgml
|
||||
from gtk-docs.sgml for now, it doesn't seem useful anymore.
|
||||
|
||||
* gtk/objects_grouped.sgml: Add a section for deprecated
|
||||
objects; add a section for the TextView object collection
|
||||
|
||||
Wed Oct 18 11:01:12 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/Makefile.am gdk-pixbuf/Makefile.am: Fix typo
|
||||
|
||||
2000-10-20 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtk-sections.txt: Add dialog docs
|
||||
|
||||
2000-10-18 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtk-sections.txt: Some updates
|
||||
|
||||
* gdk/gdk-sections.txt: remove GdkPixbufAlphaMode
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove
|
||||
GdkPixbufClass/GdkAnimationClass since those are private
|
||||
|
||||
* gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers
|
||||
|
||||
2000-10-06 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gdk-pixbuf/*.sgml, gdk-pixbuf/tmpl/*.sgml: copy in from 1.0
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-sections.txt: add Xlib sections from 1.0
|
||||
tree
|
||||
|
||||
* gdk-pixbuf/Makefile.am: add stuff from 1.0 tree
|
||||
|
||||
* gdk-pixbuf/compiling.sgml: copy from 1.0 tree
|
||||
|
||||
2000-09-26 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/tmpl/gtkrc.sgml: Document stock icon stuff
|
||||
|
||||
Thu Sep 7 14:15:03 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk/* gtk/*: Move gtk-reference files into GTK+ tree proper.
|
||||
|
||||
* Update sections.txt files to correspond to current code,
|
||||
tweak .sgml files and Makefiles to correspond.
|
||||
|
||||
* gtk/tmpl/gtkradiomenuitem.sgml (this): Remove extra <para>
|
||||
|
||||
2000-06-14 Damon Chaplin <damon@helixcode.com>
|
||||
|
||||
* gtk/tmpl/gtktooltips.sgml: added a note about no-window widgets.
|
||||
|
@@ -1,4 +0,0 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# SUBDIRS = gdk-pixbuf gdk gtk
|
||||
|
@@ -2,6 +2,4 @@ Makefile
|
||||
Makefile.in
|
||||
html
|
||||
sgml
|
||||
gdk-pixbuf-decl.txt
|
||||
gdk-pixbuf-decl-list.txt
|
||||
gdk-pixbuf-unused.txt
|
||||
gdk-pixbuf.html
|
||||
|
@@ -8,90 +8,72 @@ DOC_MAIN_SGML_FILE=gdk-pixbuf.sgml
|
||||
|
||||
# The directory containing the source code (if it contains documentation).
|
||||
DOC_SOURCE_DIR=$(GDK_PIXBUF_DIR)/gdk-pixbuf
|
||||
SECOND_DOC_SOURCE_DIR=$(top_srcdir)/contrib/gdk-pixbuf-xlib
|
||||
|
||||
# Extra options to supply to gtkdoc-fixref
|
||||
FIXXREF_OPTIONS=
|
||||
CFLAGS=`gnome-config --cflags gnomeui gdk_pixbuf gnomecanvaspixbuf`
|
||||
LDFLAGS=`gnome-config --libs gnomeui gdk_pixbuf gnomecanvaspixbuf`
|
||||
|
||||
# Header files to ignore when scanning
|
||||
IGNORE_HFILES=pixops.h pixops-internal.h gdk-pixbuf-xlib-private.h gdk-pixbuf-i18n.h gdk-pixbuf-private.h
|
||||
HTML_DIR=$(datadir)/gnome/html
|
||||
|
||||
# Extra files to add when scanning
|
||||
EXTRA_HFILES= \
|
||||
$(top_srcdir)/gtk/gdk-pixbuf-loader.h
|
||||
|
||||
# CFLAGS and LDFLAGS for compiling scan program
|
||||
CFLAGS=
|
||||
LDFLAGS=
|
||||
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
|
||||
|
||||
tmpl_sources = \
|
||||
tmpl/animation.sgml \
|
||||
tmpl/creating.sgml \
|
||||
tmpl/file-loading.sgml \
|
||||
tmpl/from-drawables.sgml \
|
||||
tmpl/gdk-pixbuf-loader.sgml \
|
||||
tmpl/gdk-pixbuf-unused.sgml \
|
||||
tmpl/gdk-pixbuf.sgml \
|
||||
tmpl/initialization_versions.sgml \
|
||||
tmpl/module_interface.sgml \
|
||||
tmpl/gnome-canvas-pixbuf.sgml \
|
||||
tmpl/refcounting.sgml \
|
||||
tmpl/rendering.sgml \
|
||||
tmpl/scaling.sgml \
|
||||
tmpl/util.sgml \
|
||||
tmpl/gdk-pixbuf-xlib-from-drawables.sgml \
|
||||
tmpl/gdk-pixbuf-xlib-init.sgml \
|
||||
tmpl/gdk-pixbuf-xlib-rendering.sgml \
|
||||
tmpl/gdk-pixbuf-xlib-rgb.sgml
|
||||
tmpl/util.sgml
|
||||
|
||||
gdk_pixbuf_docdir = $(HTML_DIR)
|
||||
gdk_pixbuf_doc_DATA = \
|
||||
gdk-pixbuf.html \
|
||||
gdk-pixbuf.hierarchy \
|
||||
gdk-pixbuf.types \
|
||||
gdk-pixbuf-decl.txt \
|
||||
gdk-pixbuf-sections.txt
|
||||
|
||||
# Extra SGML files that are included by DOC_MAIN_SGML_FILE
|
||||
content_files = \
|
||||
compiling.sgml \
|
||||
gdk-pixbuf.sgml \
|
||||
porting-from-imlib.sgml
|
||||
|
||||
####################################
|
||||
# Everything below here is generic #
|
||||
####################################
|
||||
|
||||
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
|
||||
compiling.sgml
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(DOC_MODULE).types \
|
||||
$(DOC_MAIN_SGML_FILE) \
|
||||
$(content_files) \
|
||||
$(DOC_MODULE)-sections.txt \
|
||||
$(DOC_MODULE)-overrides.txt
|
||||
$(gdk_pixbuf_doc_DATA) \
|
||||
$(content_files)
|
||||
|
||||
if ENABLE_GTK_DOC
|
||||
all-local: html/index.html
|
||||
|
||||
$(DOC_MODULE)-decl.txt:
|
||||
$(MAKE) scan
|
||||
|
||||
$(tmpl_sources): $(DOC_MODULE)-decl.txt $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt
|
||||
$(MAKE) templates
|
||||
|
||||
sgml/$(DOC_MODULE)-doc.bottom: $(tmpl_sources) $(DOC_MODULE)-decl.txt
|
||||
$(MAKE) sgml
|
||||
|
||||
html/index.html: sgml/$(DOC_MODULE)-doc.bottom $(DOC_MAIN_SGML_FILE) $(content_files)
|
||||
$(MAKE) html
|
||||
gdk-pixbuf.html: html/book1.html
|
||||
-cd $(srcdir) && cp html/book1.html gdk-pixbuf.html
|
||||
else
|
||||
gdk-pixbuf.html:
|
||||
endif
|
||||
|
||||
html/book1.html: sgml/gdk-pixbuf-doc.bottom $(content_files)
|
||||
$(MAKE) html
|
||||
|
||||
sgml/gdk-pixbuf-doc.bottom: $(tmpl_sources)
|
||||
$(MAKE) sgml
|
||||
|
||||
scan:
|
||||
-(cd $(srcdir) \
|
||||
&& gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --source-dir=$(SECOND_DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(EXTRA_HFILES))
|
||||
&& env CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) \
|
||||
gtkdoc-scanobj --module=$(DOC_MODULE) \
|
||||
&& gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="pixops.h pixops-internal.h" )
|
||||
|
||||
templates:
|
||||
templates: scan
|
||||
cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
|
||||
|
||||
sgml:
|
||||
cd $(srcdir) \
|
||||
&& gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --source-dir=$(SECOND_DOC_SOURCE_DIR)
|
||||
&& gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR)
|
||||
|
||||
html:
|
||||
test -d $(srcdir)/html || mkdir $(srcdir)/html
|
||||
-cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
|
||||
@echo '-- Fixing Crossreferences'
|
||||
cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
|
||||
|
||||
clean-local:
|
||||
rm -f *~ *.bak *.signals *-unused.txt
|
||||
@@ -111,24 +93,15 @@ install-data-local:
|
||||
done; \
|
||||
echo '-- Installing $(srcdir)/html/index.sgml' ; \
|
||||
$(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR); \
|
||||
echo '-- Fixing Crossreferences' ; \
|
||||
gtkdoc-fixxref --module=$(DOC_MODULE) --html-dir=$(HTML_DIR)|| true; \
|
||||
fi)
|
||||
|
||||
#
|
||||
# Require gtk-doc when making dist
|
||||
#
|
||||
if ENABLE_GTK_DOC
|
||||
dist-check-gtkdoc:
|
||||
else
|
||||
dist-check-gtkdoc:
|
||||
@echo "*** gtk-doc must be installed and enabled in order to make dist
|
||||
@false
|
||||
endif
|
||||
|
||||
dist-hook: dist-check-gtkdoc
|
||||
dist-hook:
|
||||
mkdir $(distdir)/html
|
||||
mkdir $(distdir)/sgml
|
||||
mkdir $(distdir)/tmpl
|
||||
-cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(srcdir)/html/index.sgml $(distdir)/html
|
||||
-cp $(srcdir)/html/*.html $(srcdir)/html/*.css $(distdir)/html
|
||||
-cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl
|
||||
-cp $(srcdir)/sgml/*.sgml $(distdir)/sgml
|
||||
-cp $(srcdir)/sgml/*.bottom $(srcdir)/sgml/*.top $(distdir)/sgml
|
||||
|
@@ -1,22 +1,22 @@
|
||||
<appendix id="compiling">
|
||||
<title>Compiling the &gdk-pixbuf; library</title>
|
||||
<title>Compiling the gdk-pixbuf library</title>
|
||||
|
||||
<para>
|
||||
This appendix describes the special options you can use while
|
||||
compiling the &gdk-pixbuf; library.
|
||||
compiling the gdk-pixbuf library.
|
||||
</para>
|
||||
|
||||
<sect1 id="building">
|
||||
<title>Building the Library</title>
|
||||
<para>
|
||||
The &gdk-pixbuf; library uses the standard GNU build system,
|
||||
using <application>autoconf</application> for package
|
||||
The gdk-pixbuf library uses the standard GNU build system,
|
||||
using <productname>autoconf</productname> for package
|
||||
configuration and resolving portability issues,
|
||||
<application>automake</application> for building makefiles
|
||||
<productname>automake</productname> for building makefiles
|
||||
that comply with the GNU Coding Standards, and
|
||||
<application>libtool</application> for building shared
|
||||
<productname>libtool</productname> for building shared
|
||||
libraries on multiple platforms. The normal sequence for
|
||||
compiling and installing the &gdk-pixbuf; library is thus:
|
||||
compiling and installing the gdk-pixbuf library is thus:
|
||||
|
||||
<literallayout>
|
||||
<userinput>./configure</userinput>
|
||||
@@ -26,10 +26,10 @@
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The standard options provided by <application>GNU
|
||||
autoconf</application> may be passed to the
|
||||
The standard options provided by <productname>GNU
|
||||
autoconf</productname> may be passed to the
|
||||
<command>configure</command> script. Please see the
|
||||
<application>autoconf</application> documentation or run
|
||||
<productname>autoconf</productname> documentation or run
|
||||
<command>./configure --help</command> for information about
|
||||
the standard options.
|
||||
</para>
|
||||
@@ -40,8 +40,8 @@
|
||||
|
||||
<para>
|
||||
In addition to the normal options, the
|
||||
<command>configure</command> script in the &gdk-pixbuf;
|
||||
library supports these additional arguments:
|
||||
<command>configure</command> script in the gdk-pixbuf library
|
||||
supports these additional arguments:
|
||||
|
||||
<cmdsynopsis>
|
||||
<command>configure</command>
|
||||
@@ -63,11 +63,11 @@
|
||||
<systemitem>--enable-modules</systemitem></title>
|
||||
|
||||
<para>
|
||||
Normally &gdk-pixbuf; will try to build the image file
|
||||
format loaders as little shared libraries that are loaded on
|
||||
Normally gdk-pixbuf 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 &gdk-pixbuf; library instead. This is useful for
|
||||
into the gdk-pixbuf 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
|
||||
@@ -83,13 +83,13 @@
|
||||
<para>
|
||||
By default the <command>configure</command> script will try
|
||||
to auto-detect whether the
|
||||
<application>gtk-doc</application> package is installed. If
|
||||
<productname>gtk-doc</productname> package is installed. If
|
||||
it is, then it will use it to extract and build the
|
||||
documentation for the &gdk-pixbuf; 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.
|
||||
documentation for the gdk-pixbuf 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>
|
||||
|
414
docs/reference/gdk-pixbuf/gdk-pixbuf-decl.txt
Normal file
@@ -0,0 +1,414 @@
|
||||
<USER_FUNCTION>
|
||||
<NAME>ModulePreparedNotifyFunc</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf, gpointer user_data
|
||||
</USER_FUNCTION>
|
||||
<USER_FUNCTION>
|
||||
<NAME>ModuleUpdatedNotifyFunc</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf,
|
||||
guint x, guint y,
|
||||
guint width, guint height,
|
||||
gpointer user_data
|
||||
</USER_FUNCTION>
|
||||
<USER_FUNCTION>
|
||||
<NAME>ModuleFrameDoneNotifyFunc</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbufFrame *frame,
|
||||
gpointer user_data
|
||||
</USER_FUNCTION>
|
||||
<USER_FUNCTION>
|
||||
<NAME>ModuleAnimationDoneNotifyFunc</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf,
|
||||
gpointer user_data
|
||||
</USER_FUNCTION>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufModule</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufModule</NAME>
|
||||
struct GdkPixbufModule {
|
||||
char *module_name;
|
||||
gboolean (* format_check) (guchar *buffer, int size);
|
||||
GModule *module;
|
||||
GdkPixbuf *(* load) (FILE *f);
|
||||
GdkPixbuf *(* load_xpm_data) (const char **data);
|
||||
|
||||
/* Incremental loading */
|
||||
|
||||
gpointer (* begin_load) (ModulePreparedNotifyFunc prepare_func,
|
||||
ModuleUpdatedNotifyFunc update_func,
|
||||
ModuleFrameDoneNotifyFunc frame_done_func,
|
||||
ModuleAnimationDoneNotifyFunc anim_done_func,
|
||||
gpointer user_data);
|
||||
void (* stop_load) (gpointer context);
|
||||
gboolean (* load_increment) (gpointer context, const guchar *buf, guint size);
|
||||
|
||||
/* Animation loading */
|
||||
GdkPixbufAnimation *(* load_animation) (FILE *f);
|
||||
};
|
||||
</STRUCT>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_module</NAME>
|
||||
<RETURNS>GdkPixbufModule *</RETURNS>
|
||||
guchar *buffer, guint size
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_load_module</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbufModule *image_module
|
||||
</FUNCTION>
|
||||
<MACRO>
|
||||
<NAME>GDK_TYPE_PIXBUF_LOADER</NAME>
|
||||
#define GDK_TYPE_PIXBUF_LOADER (gdk_pixbuf_loader_get_type ())
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_LOADER</NAME>
|
||||
#define GDK_PIXBUF_LOADER(obj) (GTK_CHECK_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_LOADER_CLASS</NAME>
|
||||
#define GDK_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_IS_PIXBUF_LOADER</NAME>
|
||||
#define GDK_IS_PIXBUF_LOADER(obj) (GTK_CHECK_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_IS_PIXBUF_LOADER_CLASS</NAME>
|
||||
#define GDK_IS_PIXBUF_LOADER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER))
|
||||
</MACRO>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufLoader</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufLoader</NAME>
|
||||
struct GdkPixbufLoader
|
||||
{
|
||||
GtkObject object;
|
||||
|
||||
/* < Private > */
|
||||
gpointer private;
|
||||
};
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GdkPixbufLoaderClass</NAME>
|
||||
</STRUCT>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_get_type</NAME>
|
||||
<RETURNS>GtkType </RETURNS>
|
||||
void
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_new</NAME>
|
||||
<RETURNS>GdkPixbufLoader *</RETURNS>
|
||||
void
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_write</NAME>
|
||||
<RETURNS>gboolean </RETURNS>
|
||||
GdkPixbufLoader *loader,const guchar *buf,size_t count
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_get_pixbuf</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbufLoader *loader
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_get_animation</NAME>
|
||||
<RETURNS>GdkPixbufAnimation *</RETURNS>
|
||||
GdkPixbufLoader *loader
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_loader_close</NAME>
|
||||
<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>
|
||||
typedef enum {
|
||||
GDK_PIXBUF_FRAME_RETAIN,
|
||||
GDK_PIXBUF_FRAME_DISPOSE,
|
||||
GDK_PIXBUF_FRAME_REVERT
|
||||
} GdkPixbufFrameAction;
|
||||
</ENUM>
|
||||
<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>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_ref</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_unref</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_art_pixbuf</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
ArtPixBuf *art_pixbuf
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
ArtPixFormat format, gboolean has_alpha, int bits_per_sample,int width, int height
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_file</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
const char *filename
|
||||
</FUNCTION>
|
||||
<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
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_new_from_xpm_data</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
const char **data
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_add_alpha</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *pixbuf, gboolean substitute_color,guchar r, guchar g, guchar b
|
||||
</FUNCTION>
|
||||
<ENUM>
|
||||
<NAME>GdkPixbufAlphaMode</NAME>
|
||||
typedef enum {
|
||||
GDK_PIXBUF_ALPHA_BILEVEL,
|
||||
GDK_PIXBUF_ALPHA_FULL
|
||||
} GdkPixbufAlphaMode;
|
||||
</ENUM>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_render_threshold_alpha</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf, GdkBitmap *bitmap,int src_x, int src_y,int dest_x, int dest_y,int width, int height,int alpha_threshold
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_render_to_drawable</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf,GdkDrawable *drawable, GdkGC *gc,int src_x, int src_y,int dest_x, int dest_y,int width, int height,GdkRgbDither dither,int x_dither, int y_dither
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_render_to_drawable_alpha</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf, GdkDrawable *drawable,int src_x, int src_y,int dest_x, int dest_y,int width, int height,GdkPixbufAlphaMode alpha_mode,int alpha_threshold,GdkRgbDither dither,int x_dither, int y_dither
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_render_pixmap_and_mask</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbuf *pixbuf,GdkPixmap **pixmap_return, GdkBitmap **mask_return,int alpha_threshold
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_get_from_drawable</NAME>
|
||||
<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>
|
||||
<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
|
||||
</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
|
||||
</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
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_scale_simple</NAME>
|
||||
<RETURNS>GdkPixbuf *</RETURNS>
|
||||
GdkPixbuf *src,int dest_width,int dest_height,ArtFilterLevel filter_level
|
||||
</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
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_new_from_file</NAME>
|
||||
<RETURNS>GdkPixbufAnimation *</RETURNS>
|
||||
const char *filename
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_ref</NAME>
|
||||
<RETURNS>GdkPixbufAnimation *</RETURNS>
|
||||
GdkPixbufAnimation *animation
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_animation_unref</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
GdkPixbufAnimation *animation
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_preinit</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
gpointer app, gpointer modinfo
|
||||
</FUNCTION>
|
||||
<FUNCTION>
|
||||
<NAME>gdk_pixbuf_postinit</NAME>
|
||||
<RETURNS>void </RETURNS>
|
||||
gpointer app, gpointer modinfo
|
||||
</FUNCTION>
|
||||
<MACRO>
|
||||
<NAME>GNOME_TYPE_CANVAS_PIXBUF</NAME>
|
||||
#define GNOME_TYPE_CANVAS_PIXBUF (gnome_canvas_pixbuf_get_type ())
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GNOME_CANVAS_PIXBUF</NAME>
|
||||
#define GNOME_CANVAS_PIXBUF(obj) (GTK_CHECK_CAST ((obj), \
|
||||
GNOME_TYPE_CANVAS_PIXBUF, GnomeCanvasPixbuf))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GNOME_CANVAS_PIXBUF_CLASS</NAME>
|
||||
#define GNOME_CANVAS_PIXBUF_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), \
|
||||
GNOME_TYPE_CANVAS_PIXBUF, GnomeCanvasPixbufClass))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GNOME_IS_CANVAS_PIXBUF</NAME>
|
||||
#define GNOME_IS_CANVAS_PIXBUF(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_CANVAS_PIXBUF))
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GNOME_IS_CANVAS_PIXBUF_CLASS</NAME>
|
||||
#define GNOME_IS_CANVAS_PIXBUF_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), \
|
||||
GNOME_TYPE_CANVAS_PIXBUF))
|
||||
</MACRO>
|
||||
<STRUCT>
|
||||
<NAME>GnomeCanvasPixbuf</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GnomeCanvasPixbufClass</NAME>
|
||||
</STRUCT>
|
||||
<STRUCT>
|
||||
<NAME>GnomeCanvasPixbuf</NAME>
|
||||
struct GnomeCanvasPixbuf {
|
||||
GnomeCanvasItem item;
|
||||
|
||||
/* Private data */
|
||||
gpointer priv;
|
||||
};
|
||||
</STRUCT>
|
||||
<FUNCTION>
|
||||
<NAME>gnome_canvas_pixbuf_get_type</NAME>
|
||||
<RETURNS>GtkType </RETURNS>
|
||||
void
|
||||
</FUNCTION>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_MAJOR</NAME>
|
||||
#define GDK_PIXBUF_MAJOR (0)
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_MINOR</NAME>
|
||||
#define GDK_PIXBUF_MINOR (4)
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_MICRO</NAME>
|
||||
#define GDK_PIXBUF_MICRO (0)
|
||||
</MACRO>
|
||||
<MACRO>
|
||||
<NAME>GDK_PIXBUF_VERSION</NAME>
|
||||
#define GDK_PIXBUF_VERSION "0.4.0"
|
||||
</MACRO>
|
||||
<VARIABLE>
|
||||
<NAME>gdk_pixbuf_version</NAME>
|
||||
extern const char *gdk_pixbuf_version;
|
||||
</VARIABLE>
|
@@ -1,28 +1,9 @@
|
||||
<INCLUDE>gdk-pixbuf/gdk-pixbuf.h</INCLUDE>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Initialization and Versions</TITLE>
|
||||
<FILE>initialization_versions</FILE>
|
||||
gdk_pixbuf_init
|
||||
gdk_pixbuf_preinit
|
||||
gdk_pixbuf_postinit
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_pixbuf_version
|
||||
GDK_PIXBUF_VERSION
|
||||
GDK_PIXBUF_MAJOR
|
||||
GDK_PIXBUF_MINOR
|
||||
GDK_PIXBUF_MICRO
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdk-pixbuf</FILE>
|
||||
GdkPixbufError
|
||||
GDK_PIXBUF_ERROR
|
||||
GdkColorspace
|
||||
GdkPixbufAlphaMode
|
||||
GdkPixbuf
|
||||
gdk_pixbuf_get_colorspace
|
||||
gdk_pixbuf_get_format
|
||||
gdk_pixbuf_get_n_channels
|
||||
gdk_pixbuf_get_has_alpha
|
||||
gdk_pixbuf_get_bits_per_sample
|
||||
@@ -30,20 +11,10 @@ gdk_pixbuf_get_pixels
|
||||
gdk_pixbuf_get_width
|
||||
gdk_pixbuf_get_height
|
||||
gdk_pixbuf_get_rowstride
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_PIXBUF
|
||||
GDK_TYPE_PIXBUF
|
||||
GDK_IS_PIXBUF
|
||||
|
||||
<SUBSECTION Private>
|
||||
gdk_pixbuf_get_type
|
||||
gdk_pixbuf_error_quark
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>refcounting</FILE>
|
||||
GdkPixbufDestroyNotify
|
||||
gdk_pixbuf_ref
|
||||
gdk_pixbuf_unref
|
||||
</SECTION>
|
||||
@@ -53,27 +24,32 @@ gdk_pixbuf_unref
|
||||
gdk_pixbuf_new_from_file
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>file-saving</FILE>
|
||||
gdk_pixbuf_savev
|
||||
gdk_pixbuf_save
|
||||
</SECTION>
|
||||
|
||||
<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_new_from_inline
|
||||
gdk_pixbuf_new_subpixbuf
|
||||
gdk_pixbuf_copy
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>rendering</FILE>
|
||||
GdkPixbufAlphaMode
|
||||
gdk_pixbuf_render_to_drawable_alpha
|
||||
gdk_pixbuf_render_to_drawable
|
||||
gdk_pixbuf_render_threshold_alpha
|
||||
gdk_pixbuf_render_pixmap_and_mask
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>from-drawables</FILE>
|
||||
gdk_pixbuf_get_from_drawable
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>util</FILE>
|
||||
gdk_pixbuf_add_alpha
|
||||
gdk_pixbuf_copy_area
|
||||
gdk_pixbuf_saturate_and_pixelate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -84,28 +60,10 @@ 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
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_PIXBUF_ANIMATION
|
||||
GDK_TYPE_PIXBUF_ANIMATION
|
||||
GDK_IS_PIXBUF_ANIMATION
|
||||
|
||||
<SUBSECTION Private>
|
||||
gdk_pixbuf_animation_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>scaling</FILE>
|
||||
GdkInterpType
|
||||
gdk_pixbuf_scale
|
||||
gdk_pixbuf_composite
|
||||
gdk_pixbuf_composite_color
|
||||
@@ -115,80 +73,33 @@ gdk_pixbuf_composite_color_simple
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdk-pixbuf-loader</FILE>
|
||||
GDK_PIXBUF_LOADER
|
||||
<TITLE>GdkPixbufLoader</TITLE>
|
||||
gdk_pixbuf_loader_new
|
||||
gdk_pixbuf_loader_new_with_type
|
||||
gdk_pixbuf_loader_write
|
||||
gdk_pixbuf_loader_get_pixbuf
|
||||
gdk_pixbuf_loader_get_animation
|
||||
gdk_pixbuf_loader_close
|
||||
<SUBSECTION Standard>
|
||||
GDK_PIXBUF_LOADER
|
||||
GDK_PIXBUF_LOADER_GET_CLASS
|
||||
GDK_TYPE_PIXBUF_LOADER
|
||||
GDK_IS_PIXBUF_LOADER
|
||||
gdk_pixbuf_loader_get_type
|
||||
GDK_PIXBUF_LOADER_CLASS
|
||||
GDK_IS_PIXBUF_LOADER_CLASS
|
||||
<SUBSECTION Private>
|
||||
GdkPixbufLoader
|
||||
gdk_pixbuf_loader_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Module Interface</TITLE>
|
||||
<FILE>module_interface</FILE>
|
||||
ModulePreparedNotifyFunc
|
||||
ModuleUpdatedNotifyFunc
|
||||
ModuleFrameDoneNotifyFunc
|
||||
ModuleAnimationDoneNotifyFunc
|
||||
GdkPixbufModule
|
||||
gdk_pixbuf_get_module
|
||||
gdk_pixbuf_get_named_module
|
||||
gdk_pixbuf_load_module
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdk-pixbuf-xlib-init</FILE>
|
||||
gdk_pixbuf_xlib_init
|
||||
gdk_pixbuf_xlib_init_with_depth
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdk-pixbuf-xlib-rendering</FILE>
|
||||
gdk_pixbuf_xlib_render_threshold_alpha
|
||||
gdk_pixbuf_xlib_render_to_drawable
|
||||
gdk_pixbuf_xlib_render_to_drawable_alpha
|
||||
gdk_pixbuf_xlib_render_pixmap_and_mask
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdk-pixbuf-xlib-from-drawables</FILE>
|
||||
gdk_pixbuf_xlib_get_from_drawable
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdk-pixbuf-xlib-rgb</FILE>
|
||||
XlibRgbCmap
|
||||
XlibRgbDither
|
||||
xlib_rgb_init
|
||||
xlib_rgb_init_with_depth
|
||||
xlib_rgb_gc_set_foreground
|
||||
xlib_rgb_gc_set_background
|
||||
xlib_draw_rgb_image
|
||||
xlib_draw_rgb_image_dithalign
|
||||
xlib_draw_rgb_32_image
|
||||
xlib_draw_gray_image
|
||||
xlib_rgb_cmap_new
|
||||
xlib_rgb_cmap_free
|
||||
xlib_draw_indexed_image
|
||||
xlib_rgb_ditherable
|
||||
xlib_rgb_set_verbose
|
||||
xlib_rgb_set_install
|
||||
xlib_rgb_set_min_colors
|
||||
xlib_rgb_get_cmap
|
||||
xlib_rgb_get_visual
|
||||
xlib_rgb_get_visual_info
|
||||
xlib_rgb_get_depth
|
||||
xlib_rgb_get_display
|
||||
xlib_rgb_get_screen
|
||||
<FILE>gnome-canvas-pixbuf</FILE>
|
||||
GNOME_CANVAS_PIXBUF
|
||||
<TITLE>GnomeCanvasPixbuf</TITLE>
|
||||
<SUBSECTION Standard>
|
||||
GNOME_TYPE_CANVAS_PIXBUF
|
||||
GNOME_IS_CANVAS_PIXBUF
|
||||
gnome_canvas_pixbuf_get_type
|
||||
GNOME_CANVAS_PIXBUF_CLASS
|
||||
GNOME_IS_CANVAS_PIXBUF_CLASS
|
||||
<SUBSECTION Private>
|
||||
GnomeCanvasPixbuf
|
||||
</SECTION>
|
||||
|
@@ -1,28 +1,21 @@
|
||||
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN"[
|
||||
|
||||
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
|
||||
<!entity gdk-pixbuf-gdk-pixbuf SYSTEM "sgml/gdk-pixbuf.sgml">
|
||||
<!entity gdk-pixbuf-refcounting SYSTEM "sgml/refcounting.sgml">
|
||||
<!entity gdk-pixbuf-file-loading SYSTEM "sgml/file-loading.sgml">
|
||||
<!entity gdk-pixbuf-creating SYSTEM "sgml/creating.sgml">
|
||||
<!entity gdk-pixbuf-rendering SYSTEM "sgml/rendering.sgml">
|
||||
<!entity gdk-pixbuf-scaling SYSTEM "sgml/scaling.sgml">
|
||||
<!entity gdk-pixbuf-from-drawables SYSTEM "sgml/from-drawables.sgml">
|
||||
<!entity gdk-pixbuf-util SYSTEM "sgml/util.sgml">
|
||||
<!entity gdk-pixbuf-animation SYSTEM "sgml/animation.sgml">
|
||||
<!entity GdkPixbufLoader SYSTEM "sgml/gdk-pixbuf-loader.sgml">
|
||||
<!entity gdk-pixbuf-gdk-pixbuf-xlib-init SYSTEM "sgml/gdk-pixbuf-xlib-init.sgml">
|
||||
<!entity gdk-pixbuf-gdk-pixbuf-xlib-rendering SYSTEM "sgml/gdk-pixbuf-xlib-rendering.sgml">
|
||||
<!entity gdk-pixbuf-gdk-pixbuf-xlib-from-drawables SYSTEM "sgml/gdk-pixbuf-xlib-from-drawables.sgml">
|
||||
<!entity gdk-pixbuf-gdk-pixbuf-xlib-rgb SYSTEM "sgml/gdk-pixbuf-xlib-rgb.sgml">
|
||||
|
||||
<!entity Porting-From-Imlib SYSTEM "porting-from-imlib.sgml">
|
||||
<!entity GnomeCanvasPixbuf SYSTEM "sgml/gnome-canvas-pixbuf.sgml">
|
||||
<!entity Compiling SYSTEM "compiling.sgml">
|
||||
|
||||
<!entity gdk-pixbuf "<application>gdk-pixbuf</application>">
|
||||
<!entity Imlib "<application>Imlib</application>">
|
||||
]>
|
||||
|
||||
<book id="index">
|
||||
<book>
|
||||
<bookinfo>
|
||||
<title>The &gdk-pixbuf; Library</title>
|
||||
<title>The GdkPixbuf Library</title>
|
||||
|
||||
<authorgroup>
|
||||
<author>
|
||||
@@ -37,39 +30,9 @@
|
||||
</authorgroup>
|
||||
|
||||
<copyright>
|
||||
<year>2000</year>
|
||||
<year>1999</year>
|
||||
<holder>The Free Software Foundation</holder>
|
||||
</copyright>
|
||||
|
||||
<legalnotice>
|
||||
<para>
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the <citetitle>GNU Free
|
||||
Documentation License</citetitle>, Version 1.1 or any later
|
||||
version published by the Free Software Foundation with no
|
||||
Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
||||
Texts. You may obtain a copy of the <citetitle>GNU Free
|
||||
Documentation License</citetitle> from the Free Software
|
||||
Foundation by visiting <ulink type="http"
|
||||
url="http://www.fsf.org">their Web site</ulink> or by writing
|
||||
to:
|
||||
|
||||
<address>
|
||||
The Free Software Foundation, Inc.,
|
||||
<street>59 Temple Place</street> - Suite 330,
|
||||
<city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>,
|
||||
<country>USA</country>
|
||||
</address>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Many of the names used by companies to distinguish their
|
||||
products and services are claimed as trademarks. Where those
|
||||
names appear in any GNOME documentation, and those trademarks
|
||||
are made aware to the members of the GNOME Documentation
|
||||
Project, the names have been printed in caps or initial caps.
|
||||
</para>
|
||||
</legalnotice>
|
||||
</bookinfo>
|
||||
|
||||
<reference>
|
||||
@@ -78,9 +41,8 @@
|
||||
<partintro>
|
||||
<para>
|
||||
This part presents the class and function reference for the
|
||||
&gdk-pixbuf; library. Classes are described together with
|
||||
their methods; individual functions are grouped by functional
|
||||
group.
|
||||
GdkPixbuf library. Classes are described together with their
|
||||
methods; individual functions are grouped by functional group.
|
||||
</para>
|
||||
</partintro>
|
||||
|
||||
@@ -88,54 +50,14 @@
|
||||
&gdk-pixbuf-refcounting;
|
||||
&gdk-pixbuf-file-loading;
|
||||
&gdk-pixbuf-creating;
|
||||
&gdk-pixbuf-rendering;
|
||||
&gdk-pixbuf-scaling;
|
||||
&gdk-pixbuf-from-drawables;
|
||||
&gdk-pixbuf-util;
|
||||
&gdk-pixbuf-animation;
|
||||
|
||||
&GdkPixbufLoader;
|
||||
|
||||
&gdk-pixbuf-gdk-pixbuf-xlib-init;
|
||||
&gdk-pixbuf-gdk-pixbuf-xlib-rendering;
|
||||
&gdk-pixbuf-gdk-pixbuf-xlib-from-drawables;
|
||||
&gdk-pixbuf-gdk-pixbuf-xlib-rgb;
|
||||
&GnomeCanvasPixbuf;
|
||||
</reference>
|
||||
|
||||
&Porting-From-Imlib;
|
||||
&Compiling;
|
||||
|
||||
<!-- License -->
|
||||
|
||||
<appendix id="license">
|
||||
<title>License</title>
|
||||
|
||||
<para>
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the <citetitle>GNU Library General
|
||||
Public License</citetitle> as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
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
|
||||
<citetitle>GNU Library General Public License</citetitle> for
|
||||
more details.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You may obtain a copy of the <citetitle>GNU Library General
|
||||
Public License</citetitle> from the Free Software Foundation by
|
||||
visiting <ulink type="http" url="http://www.fsf.org">their Web
|
||||
site</ulink> or by writing to:
|
||||
|
||||
<address>
|
||||
Free Software Foundation, Inc.
|
||||
<street>59 Temple Place</street> - Suite 330
|
||||
<city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>
|
||||
<country>USA</country>
|
||||
</address>
|
||||
</para>
|
||||
</appendix>
|
||||
</book>
|
||||
|
@@ -18,7 +18,6 @@ GdkPixbufLoader *gdkpixbufloader
|
||||
<NAME>GdkPixbufLoader::frame-done</NAME>
|
||||
<RETURNS>void</RETURNS>
|
||||
GdkPixbufLoader *gdkpixbufloader
|
||||
gpointer arg1
|
||||
</SIGNAL>
|
||||
|
||||
<SIGNAL>
|
||||
|
@@ -1,4 +1,7 @@
|
||||
#include <gnome.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
|
||||
#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
|
||||
|
||||
gdk_pixbuf_loader_get_type
|
||||
gnome_canvas_pixbuf_get_type
|
||||
|
@@ -1,360 +0,0 @@
|
||||
<appendix>
|
||||
<title>Porting applications from &Imlib; to &gdk-pixbuf;</title>
|
||||
|
||||
<para>
|
||||
This appendix contains the basic steps needed to port an
|
||||
application that uses the &Imlib; library to use &gdk-pixbuf;
|
||||
instead.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
This appendix refers to version 1 of the &Imlib; library; this
|
||||
discussion is not relevant to Imlib 2. Also, we discuss the
|
||||
gdk_imlib API instead of the Xlib-based API.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<!-- Introduction -->
|
||||
|
||||
<sect1>
|
||||
<title>Introduction</title>
|
||||
|
||||
<para>
|
||||
Prior to the GNOME 1.2 platform, the &Imlib; library was the
|
||||
preferred way of loading and rendering images in GNOME
|
||||
applications. Unfortunately, &Imlib; has important design
|
||||
limitations that make it hard to write efficient and highly
|
||||
modular applications.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The &gdk-pixbuf; library was designed as a solution to
|
||||
&Imlib;'s shortcomings. It provides a simple, orthogonal API
|
||||
and convenience functions for the most common operations. In
|
||||
addition, it supports full transparency information for
|
||||
images, or alpha channel. More importantly, it has
|
||||
well-defined semantics for memory management through the use
|
||||
of reference counting; &Imlib; has an intractably complex
|
||||
memory management mechanism and cache that will make your head
|
||||
spin.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<!-- Differences between Imlib and gdk-pixbuf -->
|
||||
|
||||
<sect1>
|
||||
<title>Differences between &Imlib; and &gdk-pixbuf;</title>
|
||||
|
||||
<para>
|
||||
Generally, applications that use &Imlib; do not have to be
|
||||
changed extensively to use &gdk-pixbuf;; its simple and
|
||||
flexible API makes things easy. This section describes the
|
||||
differences between &Imlib; and &gdk-pixbuf;; you should take
|
||||
these into account when modifying your applications to use
|
||||
&gdk-pixbuf;.
|
||||
</para>
|
||||
|
||||
<!-- Initialization -->
|
||||
|
||||
<sect2>
|
||||
<title>Initialization</title>
|
||||
|
||||
<para>
|
||||
The &gdk-pixbuf; library does not need to be initialized.
|
||||
However, if you intend to use the rendering functions or
|
||||
anything else from the <application>GdkRGB</application>
|
||||
library, you should call <function>gdk_rgb_init()</function>
|
||||
after calling <function>gtk_init()</function> or
|
||||
<function>gnome_init()</function> in your program.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
In GNOME applications you normally don't need to
|
||||
initialize &Imlib;, as <function>gnome_init()</function>
|
||||
calls <function>gdk_imlib_init()</function> automatically.
|
||||
</para>
|
||||
</note>
|
||||
</sect2>
|
||||
|
||||
<!-- Memory management -->
|
||||
|
||||
<sect2>
|
||||
<title>Memory management</title>
|
||||
|
||||
<para>
|
||||
The &gdk-pixbuf; library provides a simple, well-defined
|
||||
memory management mechanism for images in the form of
|
||||
reference counting. This makes it very convenient to use
|
||||
for large-scale applications that need to share images
|
||||
between different parts of the program. In stark contrast,
|
||||
&Imlib; has a terribly complex mechanism of an image and
|
||||
pixmap cache which makes it very hard for applications to
|
||||
share image structures between different parts of the
|
||||
program. Unfortunately this mechanism makes things very
|
||||
prone to memory leaks and tricky bugs.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The basic principle in &gdk-pixbuf; is that when you obtain
|
||||
a new <link linkend="GdkPixbuf">GdkPixbuf</link> structure,
|
||||
it is created with an initial reference count of 1. When
|
||||
another part of the program wants to keep a reference to the
|
||||
pixbuf, it should call <link
|
||||
linkend="gdk-pixbuf-ref">gdk_pixbuf_ref()</link>; this will
|
||||
increase the reference count by 1. When some part of the
|
||||
program does not need to keep a reference to a pixbuf
|
||||
anymore and wants to release the pixbuf, it should call
|
||||
<link linkend="gdk-pixbuf-unref">gdk_pixbuf_unref()</link>;
|
||||
this will decrease the reference count by 1. When the
|
||||
reference count drops to zero, the pixbuf gets destroyed or
|
||||
<emphasis>finalized</emphasis> and its memory is freed.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For applications that need to implement a cache of loaded
|
||||
images, &gdk-pixbuf; provides a way to hook to the last
|
||||
unreference operation of a pixbuf; instead of finalizing the
|
||||
pixbuf, the user-installed hook can decide to keep it around
|
||||
in a cache instead.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Finally, &gdk-pixbuf; does not provide a cache of rendered
|
||||
pixmaps. This is unnecessary for most applications, since
|
||||
the scaling and rendering functions are quite fast and
|
||||
applications may need to use subtly different values each
|
||||
time they call these functions, for example, to take into
|
||||
account dithering and zooming offsets.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Most applications will simply need to call
|
||||
<function>gdk_pixbuf_ref()</function> when they want to keep
|
||||
an extra reference to a pixbuf, and then
|
||||
<function>gdk_pixbuf_unref()</function> when they are done
|
||||
with it.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<!-- The Rendering Process -->
|
||||
|
||||
<sect2>
|
||||
<title>The Rendering Process</title>
|
||||
|
||||
<para>
|
||||
The &gdk-pixbuf; library has the policy of always rendering
|
||||
pixbufs to Gdk drawables you provide; it will not create
|
||||
them for you. This is in general more flexible than
|
||||
&Imlib;'s policy of always creating a pixmap and making you
|
||||
use that instead.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The disadvantage of always having a pixmap created for you
|
||||
is that it wastes memory in the X server if you intend to
|
||||
copy that rendered data onto another drawable, for example,
|
||||
the final destination window or a temporary pixmap for
|
||||
drawing. This is the most common case, unfortunately, so
|
||||
the &Imlib; policy introduces unnecessary copying.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Also, &Imlib; can only render pixmaps that are the whole
|
||||
size of the source image; you cannot render just a subset
|
||||
region of the image. This is inconvenient for applications
|
||||
that need to render small portions at a time, such as
|
||||
applications that do scrolling. Since the whole image must
|
||||
be rendered at a time, this can lead to performance and
|
||||
memory usage problems.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The &gdk-pixbuf; library lets you render any rectangular
|
||||
region from an image onto any drawable that you provide.
|
||||
This lets the application have fine control the way images
|
||||
are rendered.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<!-- Converting Applications to gdk-pixbuf -->
|
||||
|
||||
<sect1>
|
||||
<title>Converting Applications to &gdk-pixbuf;</title>
|
||||
|
||||
<para>
|
||||
This sections describes the actual changes you need to make in
|
||||
an &Imlib; program to make it use &gdk-pixbuf; instead.
|
||||
</para>
|
||||
|
||||
<!-- Image loading and creation -->
|
||||
|
||||
<sect2>
|
||||
<title>Image loading and creation</title>
|
||||
|
||||
<para>
|
||||
The &gdk-pixbuf; library can load image files synchronously
|
||||
(i.e. with a single function call), create images from RGB
|
||||
data in memory, and as a convenience, it can also create
|
||||
images from inline XPM data.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To load an image file in a single function call, simply use
|
||||
<function>gdk_pixbuf_new_from_file()</function>. Note that
|
||||
this will make the program block until the whole file has
|
||||
been read. This function effectively replaces
|
||||
<function>gdk_imlib_load_image()</function>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you have RGB data in memory, you can use
|
||||
<function>gdk_pixbuf_new_from_data()</function> to create a
|
||||
pixbuf out of it; this is a replacement for
|
||||
<function>gdk_imlib_create_image_from_data()</function>.
|
||||
&gdk-pixbuf; does not copy the image data; it is up to you
|
||||
to define the ownership policy by providing a destroy
|
||||
notification function that will be called when the image
|
||||
data needs to be freed. The function you provide can then
|
||||
free the data or do something else, as appropriate.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
As a convenience, you can use the
|
||||
<function>gdk_pixbuf_new_from_xpm_data()</function> function
|
||||
to create a pixbuf out of inline XPM data that was compiled
|
||||
into your C program. This is a replacement for
|
||||
<function>gdk_imlib_create_image_from_xpm_data()</function>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
After you have created a pixbuf, you can manipulate it in
|
||||
any way you please and then finally call
|
||||
<function>gdk_pixbuf_unref()</function> when you are done
|
||||
with it. This can be thought of as a replacement for
|
||||
<function>gdk_imlib_destroy_image()</function> but with much
|
||||
cleaner semantics.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<!-- Rendering Images -->
|
||||
|
||||
<sect2>
|
||||
<title>Rendering Images</title>
|
||||
|
||||
<para>
|
||||
Applications that use &Imlib; must first call
|
||||
<function>gdk_imlib_render()</function> to render the whole
|
||||
image data onto a pixmap that &Imlib; creates. Then they
|
||||
must copy that pixmap's data into the final destination for
|
||||
the image.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In contrast, &gdk-pixbuf; provides convenience functions to
|
||||
render arbitrary rectangular regions of an image onto a
|
||||
drawable that your application provides. You can use
|
||||
<function>gdk_pixbuf_render_to_drawable()</function> or
|
||||
<function>gdk_pixbuf_render_to_drawable_alpha()</function>
|
||||
to do this; having your application provide the destination
|
||||
drawable and specify an arbitrary region means your
|
||||
application has complete control over the way images are
|
||||
rendered.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
As a convenience, &gdk-pixbuf; also provides the
|
||||
<function>gdk_pixbuf_render_pixmap_and_mask()</function>
|
||||
function; this will create new pixmap and mask drawables for
|
||||
a whole pixbuf and render the image data onto them. Only
|
||||
trivially simple applications should find a use for this
|
||||
function, since usually you want finer control of how things
|
||||
are rendered.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<!-- Scaling Images -->
|
||||
|
||||
<sect2>
|
||||
<title>Scaling Images</title>
|
||||
|
||||
<para>
|
||||
&Imlib; lets you render scaled image data at the time you
|
||||
call <function>gdk_imlib_render()</function>. Again, this
|
||||
unfortunately scales and renders the whole image onto a new
|
||||
pixmap.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
&gdk-pixbuf; provides a number of functions that do scaling
|
||||
of arbitrary regions of a source pixbuf onto a destination
|
||||
one. These functions can also perform compositing
|
||||
operations against the data in the destination pixbuf or
|
||||
against a solid color or a colored checkerboard.
|
||||
<footnote>
|
||||
<para>
|
||||
You can use a colored checkerboard as the background for
|
||||
compositing when you want to provide a visual indication
|
||||
that the image has partially opaque areas. This is
|
||||
normally used in image editing and viewing programs.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Compositing against a single solid color is actually a
|
||||
special case of a checkerboard; it simply uses checks of
|
||||
the same color.
|
||||
</para>
|
||||
</footnote>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Very simple applications may find it sufficient to use
|
||||
<function>gdk_pixbuf_scale_simple()</function> or
|
||||
<function>gdk_pixbuf_composite_color_simple()</function>.
|
||||
These functions scale the whole source image at a time and
|
||||
create a new pixbuf with the result.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
More sophisticated applications will need to use
|
||||
<function>gdk_pixbuf_scale()</function>,
|
||||
<function>gdk_pixbuf_composite()</function>, or
|
||||
<function>gdk_pixbuf_composite_color()</function> instead.
|
||||
These functions let you scale and composite an arbitrary
|
||||
region of the source pixbuf onto a destination pixbuf that
|
||||
you provide.
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
<!-- Getting Image Data from a Drawable -->
|
||||
|
||||
<sect2>
|
||||
<title>Getting Image Data from a Drawable</title>
|
||||
|
||||
<para>
|
||||
&Imlib; lets you create an image by fetching a drawable's
|
||||
contents from the X server and converting those into RGB
|
||||
data. This is done with the
|
||||
<function>gdk_imlib_create_image_from_drawable()</function>
|
||||
function.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
&gdk-pixbuf; provides the
|
||||
<function>gdk_pixbuf_get_from_drawable()</function> function
|
||||
instead. It lets you specify a destination pixbuf instead
|
||||
of always creating a new one for you.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
</appendix>
|
||||
|
||||
<!--
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-parent-document: ("gdk-pixbuf.sgml" "book" "book" "")
|
||||
End:
|
||||
-->
|
||||
|