Import GNU Classpath (libgcj-import-20070727).

libjava/

2007-08-04  Matthias Klose  <doko@ubuntu.com>

	Import GNU Classpath (libgcj-import-20070727).

	* Regenerate class and header files.
	* Regenerate auto* files.

	* include/jvm.h:
	* jni-libjvm.cc (Jv_JNI_InvokeFunctions): Rename type.
	* jni.cc (_Jv_JNIFunctions, _Jv_JNI_InvokeFunctions): Likewise.
	* jni.cc (_Jv_JNI_CallAnyMethodA, _Jv_JNI_CallAnyVoidMethodA,
	_Jv_JNI_CallMethodA, _Jv_JNI_CallVoidMethodA,
	_Jv_JNI_CallStaticMethodA, _Jv_JNI_CallStaticVoidMethodA,
	_Jv_JNI_NewObjectA, _Jv_JNI_SetPrimitiveArrayRegion): Constify
	jvalue parameter.
	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise.

	* java/lang/VMFloat.java (toString, parseFloat): New.

	* gnu/awt/xlib/XToolkit.java (setAlwaysOnTop, isModalityTypeSupported,
	isModalExclusionTypeSupported): New (stub only).
	* gnu/awt/xlib/XCanvasPeer.java (requestFocus): Likewise.
	* gnu/awt/xlib/XFramePeer.java (updateMinimumSize, updateIconImages,
	updateFocusableWindowState, setModalBlocked, getBoundsPrivate,
	setAlwaysOnTop): Likewise.
	* gnu/awt/xlib/XFontPeer.java (canDisplay): Update signature.

	* scripts/makemake.tcl: Ignore gnu/javax/sound/sampled/gstreamer,
	ignore javax.sound.sampled.spi.MixerProvider, ignore .in files.

	* HACKING: Mention --enable-gstreamer-peer, removal of generated files.


libjava/classpath/

2007-08-04  Matthias Klose  <doko@ubuntu.com>

	* java/util/EnumMap.java (clone): Add cast.

From-SVN: r127204
This commit is contained in:
Matthias Klose 2007-08-04 10:53:49 +00:00
parent 2c3de459b6
commit f06a83c0b2
522 changed files with 13385 additions and 4867 deletions

View File

@ -1,3 +1,35 @@
2007-08-04 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (libgcj-import-20070727).
* Regenerate class and header files.
* Regenerate auto* files.
* include/jvm.h:
* jni-libjvm.cc (Jv_JNI_InvokeFunctions): Rename type.
* jni.cc (_Jv_JNIFunctions, _Jv_JNI_InvokeFunctions): Likewise.
* jni.cc (_Jv_JNI_CallAnyMethodA, _Jv_JNI_CallAnyVoidMethodA,
_Jv_JNI_CallMethodA, _Jv_JNI_CallVoidMethodA,
_Jv_JNI_CallStaticMethodA, _Jv_JNI_CallStaticVoidMethodA,
_Jv_JNI_NewObjectA, _Jv_JNI_SetPrimitiveArrayRegion): Constify
jvalue parameter.
* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise.
* java/lang/VMFloat.java (toString, parseFloat): New.
* gnu/awt/xlib/XToolkit.java (setAlwaysOnTop, isModalityTypeSupported,
isModalExclusionTypeSupported): New (stub only).
* gnu/awt/xlib/XCanvasPeer.java (requestFocus): Likewise.
* gnu/awt/xlib/XFramePeer.java (updateMinimumSize, updateIconImages,
updateFocusableWindowState, setModalBlocked, getBoundsPrivate,
setAlwaysOnTop): Likewise.
* gnu/awt/xlib/XFontPeer.java (canDisplay): Update signature.
* scripts/makemake.tcl: Ignore gnu/javax/sound/sampled/gstreamer,
ignore javax.sound.sampled.spi.MixerProvider, ignore .in files.
* HACKING: Mention --enable-gstreamer-peer, removal of generated files.
2007-07-31 David Daney <ddaney@avtrex.com>
* HACKING: Document regenerating configure and aclocal.m4.

View File

@ -104,17 +104,27 @@ To import a new release:
cd ..
scripts/makemake.tcl > sources.am
automake
- Remove the generated class and header files:
find classpath -name '*.class' xargs -r rm -f
find gnu java javax org sun -name '*.h' \
| xargs -r grep -Fl 'DO NOT EDIT THIS FILE - it is machine generated' \
| xargs -r rm -f
- Build, fix, till everything works.
Be sure to build all peers (--enable-java-awt=gtk,xlib,qt
--enable-gconf-peer)
--enable-gconf-peer --enable-gstreamer-peer)
Be sure to update gnu/classpath/Configuration.java to reflect
the new version
Possibly update the gcj/javaprims.h file with scripts/classes.pl
(See below, it can only be done after the first source->bytecode
pass has finished.)
You will need to configure with --enable-maintainer-mode and you
You will need to configure with --enable-java-maintainer-mode and you
will need to update the .class files and generated CNI header files in
your working tree
- Add/Remove newly generated files:
- svn status classpath | grep '^\!.*\.class$' | cut -c8- | xargs svn remove
- svn status classpath | grep '^\?' | cut -c8- | xargs svn add
- svn status gnu java javax org sun | grep '^\!.*\.h$' | cut -c8- | xargs svn remove
- svn status gnu java javax org sun | grep '^\?' | cut -c8- | xargs svn add
Over time we plan to remove as many of the remaining divergences as
possible.

View File

@ -223,10 +223,10 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
gnu/javax/print/ipp/attribute/printer.lo \
gnu/javax/print/ipp/attribute/supported.lo \
gnu/javax/security/auth.lo gnu/javax/security/auth/callback.lo \
gnu/javax/security/auth/login.lo gnu/javax/sound/sampled/AU.lo \
gnu/javax/sound/sampled/WAV.lo gnu/javax/swing/plaf/gnu.lo \
gnu/javax/swing/plaf/metal.lo gnu/javax/swing/text/html.lo \
gnu/javax/swing/text/html/css.lo \
gnu/javax/security/auth/login.lo gnu/javax/sound.lo \
gnu/javax/sound/sampled/AU.lo gnu/javax/sound/sampled/WAV.lo \
gnu/javax/swing/plaf/gnu.lo gnu/javax/swing/plaf/metal.lo \
gnu/javax/swing/text/html.lo gnu/javax/swing/text/html/css.lo \
gnu/javax/swing/text/html/parser/GnuParserDelegator.lo \
gnu/javax/swing/text/html/parser/HTML_401F.lo \
gnu/javax/swing/text/html/parser/SmallHtmlAttributeSet.lo \
@ -278,9 +278,9 @@ am__DEPENDENCIES_2 = gnu/awt.lo gnu/awt/j2d.lo gnu/classpath.lo \
javax/swing/text/html.lo javax/swing/text/html/parser.lo \
javax/swing/text/rtf.lo javax/swing/tree.lo \
javax/swing/undo.lo javax/transaction.lo \
javax/transaction/xa.lo org/ietf/jgss.lo sun/misc.lo \
sun/reflect.lo sun/reflect/annotation.lo sun/reflect/misc.lo \
$(am__DEPENDENCIES_1)
javax/transaction/xa.lo org/ietf/jgss.lo sun/awt.lo \
sun/misc.lo sun/reflect.lo sun/reflect/annotation.lo \
sun/reflect/misc.lo $(am__DEPENDENCIES_1)
am__DEPENDENCIES_3 = gnu-CORBA.lo gnu-java-awt-dnd-peer-gtk.lo \
gnu-java-awt-peer-gtk.lo gnu-java-awt-peer-swing.lo \
gnu-java-beans.lo gnu-java-lang-management.lo \
@ -1524,12 +1524,14 @@ classpath/gnu/java/awt/java2d/AlphaCompositeContext.java \
classpath/gnu/java/awt/java2d/CubicSegment.java \
classpath/gnu/java/awt/java2d/ImagePaint.java \
classpath/gnu/java/awt/java2d/LineSegment.java \
classpath/gnu/java/awt/java2d/Pixelizer.java \
classpath/gnu/java/awt/java2d/PolyEdge.java \
classpath/gnu/java/awt/java2d/PolyEdgeComparator.java \
classpath/gnu/java/awt/java2d/QuadSegment.java \
classpath/gnu/java/awt/java2d/RasterGraphics.java \
classpath/gnu/java/awt/java2d/Scanline.java \
classpath/gnu/java/awt/java2d/ScanlineConverter.java \
classpath/gnu/java/awt/java2d/ScanlineCoverage.java \
classpath/gnu/java/awt/java2d/Segment.java \
classpath/gnu/java/awt/java2d/ShapeCache.java \
classpath/gnu/java/awt/java2d/TexturePaintContext.java
@ -1650,6 +1652,7 @@ classpath/gnu/java/awt/peer/qt/QtWindowPeer.java
gnu_java_awt_peer_swing_source_files = \
classpath/gnu/java/awt/peer/swing/SwingButtonPeer.java \
classpath/gnu/java/awt/peer/swing/SwingCanvasPeer.java \
classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java \
classpath/gnu/java/awt/peer/swing/SwingComponent.java \
classpath/gnu/java/awt/peer/swing/SwingComponentPeer.java \
classpath/gnu/java/awt/peer/swing/SwingContainerPeer.java \
@ -1669,20 +1672,19 @@ gnu_java_awt_peer_x_source_files = \
classpath/gnu/java/awt/peer/x/GLGraphics.java \
classpath/gnu/java/awt/peer/x/ImageConverter.java \
classpath/gnu/java/awt/peer/x/KeyboardMapping.java \
classpath/gnu/java/awt/peer/x/PixmapVolatileImage.java \
classpath/gnu/java/awt/peer/x/XDialogPeer.java \
classpath/gnu/java/awt/peer/x/XEventPump.java \
classpath/gnu/java/awt/peer/x/XFontPeer.java \
classpath/gnu/java/awt/peer/x/XFontPeer2.java \
classpath/gnu/java/awt/peer/x/XFramePeer.java \
classpath/gnu/java/awt/peer/x/XGraphics.java \
classpath/gnu/java/awt/peer/x/XGraphics2D.java \
classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java \
classpath/gnu/java/awt/peer/x/XGraphicsDevice.java \
classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java \
classpath/gnu/java/awt/peer/x/XImage.java \
classpath/gnu/java/awt/peer/x/XLightweightPeer.java \
classpath/gnu/java/awt/peer/x/XToolkit.java \
classpath/gnu/java/awt/peer/x/XWindowPeer.java
classpath/gnu/java/awt/peer/x/XWindowPeer.java \
classpath/gnu/java/awt/peer/x/ZPixmapDataBuffer.java
gnu_java_awt_print_source_files = \
classpath/gnu/java/awt/print/JavaPrinterGraphics.java \
@ -3221,6 +3223,10 @@ classpath/gnu/javax/security/auth/login/ConfigFileTokenizer.java \
classpath/gnu/javax/security/auth/login/GnuConfiguration.java
gnu_javax_security_auth_login_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_security_auth_login_source_files)))
gnu_javax_sound_source_files = \
classpath/gnu/javax/sound/AudioSecurityManager.java
gnu_javax_sound_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_javax_sound_source_files)))
gnu_javax_sound_midi_source_files = \
classpath/gnu/javax/sound/midi/alsa/AlsaInputPortDevice.java \
classpath/gnu/javax/sound/midi/alsa/AlsaMidiDeviceProvider.java \
@ -4523,6 +4529,7 @@ classpath/java/nio/ByteBufferImpl.java \
classpath/java/nio/ByteOrder.java \
classpath/java/nio/CharBuffer.java \
classpath/java/nio/CharBufferImpl.java \
classpath/java/nio/CharSequenceBuffer.java \
classpath/java/nio/CharViewBufferImpl.java \
java/nio/DirectByteBufferImpl.java \
classpath/java/nio/DoubleBuffer.java \
@ -7295,6 +7302,10 @@ classpath/external/sax/org/xml/sax/helpers/XMLFilterImpl.java \
classpath/external/sax/org/xml/sax/helpers/XMLReaderAdapter.java \
classpath/external/sax/org/xml/sax/helpers/XMLReaderFactory.java
sun_awt_source_files = \
classpath/sun/awt/CausedFocusEvent.java
sun_awt_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(sun_awt_source_files)))
sun_misc_source_files = \
classpath/sun/misc/Service.java \
classpath/sun/misc/ServiceConfigurationError.java \
@ -7460,6 +7471,7 @@ all_packages_source_files = \
gnu/javax/security/auth.list \
gnu/javax/security/auth/callback.list \
gnu/javax/security/auth/login.list \
gnu/javax/sound.list \
gnu/javax/sound/sampled/AU.list \
gnu/javax/sound/sampled/WAV.list \
gnu/javax/swing/plaf/gnu.list \
@ -7581,6 +7593,7 @@ all_packages_source_files = \
javax/transaction.list \
javax/transaction/xa.list \
org/ietf/jgss.list \
sun/awt.list \
sun/misc.list \
sun/reflect.list \
sun/reflect/annotation.list \
@ -7706,6 +7719,7 @@ ordinary_header_files = \
$(gnu_javax_security_auth_header_files) \
$(gnu_javax_security_auth_callback_header_files) \
$(gnu_javax_security_auth_login_header_files) \
$(gnu_javax_sound_header_files) \
$(gnu_javax_sound_sampled_AU_header_files) \
$(gnu_javax_sound_sampled_WAV_header_files) \
$(gnu_javax_swing_plaf_gnu_header_files) \
@ -7822,6 +7836,7 @@ ordinary_header_files = \
$(javax_transaction_header_files) \
$(javax_transaction_xa_header_files) \
$(org_ietf_jgss_header_files) \
$(sun_awt_header_files) \
$(sun_misc_header_files) \
$(sun_reflect_header_files) \
$(sun_reflect_annotation_header_files) \
@ -10966,6 +10981,12 @@ gnu/javax/security/auth/login.list: $(gnu_javax_security_auth_login_source_files
-include gnu/javax/security/auth/login.deps
gnu/javax/sound.list: $(gnu_javax_sound_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/gnu/javax/sound/*.class > gnu/javax/sound.list
-include gnu/javax/sound.deps
gnu-javax-sound-midi.lo: $(gnu_javax_sound_midi_source_files)
@find $(srcdir)/classpath/lib/gnu/javax/sound/midi -name '*.class' > gnu-javax-sound-midi.list
$(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-javax-sound-midi.lo @gnu-javax-sound-midi.list
@ -11782,6 +11803,12 @@ org-xml.lo: $(org_xml_source_files)
$(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o org-xml.lo @org-xml.list
@rm -f org-xml.list
sun/awt.list: $(sun_awt_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/sun/awt/*.class > sun/awt.list
-include sun/awt.deps
sun/misc.list: $(sun_misc_source_files)
@$(mkinstalldirs) $(dir $@)
echo $(srcdir)/classpath/lib/sun/misc/*.class > sun/misc.list

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,7 @@
2007-08-04 Matthias Klose <doko@ubuntu.com>
* java/util/EnumMap.java (clone): Add cast.
2007-07-12 Matthias Klose <doko@ubuntu.com>
* lib/jazzlib, tools/gnu/classpath/tools/rmi: Remove empty directories.

View File

@ -1,225 +1,236 @@
Installing GNU Classpath - Last updated: June 19, 2006
Installation Instructions
*************************
First, this is a development release only! Unless you are interested in
active development and debugging, or just like running random alpha code,
this release is probably not for you. Please see the README file for a
list of VMs that work with GNU Classpath.
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
Note that if you are building from a non-released (CVS) version of GNU
classpath, installation instructions are found in the doc/hacking.texi
file. Or at http://www.gnu.org/software/classpath/docs/hacking.html
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
------------------------------------------------------------------
Suggested Software
------------------------------------------------------------------
GNU make ("gmake") is required for building Classpath.
Basic Installation
==================
For any build environment involving native libraries, these
new versions of autoconf, automake, and libtool are required
if changes are made that require rebuilding configure, Makefile.in,
aclocal.m4, or config.h.in.
These are generic installation instructions.
- GNU autoconf 2.59+
- GNU automake 1.9+
- GNU libtool 1.5+
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
When working from CVS you can run the above tools by executing
./autogen.sh in the source directory.
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
For building the Java bytecode (.class files), one of these
compilers are required. You can select which compiler using
--with-jikes, --with-gcj, --with-ecj or --with-kjc as argument to
configure; the present default is gcj.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
- GCJ 4.0+ (part of the GNU GCC package).
- IBM jikes 1.19+.
- Eclipse Compiler for Java 3.1+
- The kjc compiler is supported with configure but we have
been unable to successfully compile with it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
IMPORTANT: Versions of GCJ which are earlier than 4.0 contain
bugs which make it impossible to compile the class library and
are *not* supported any more. If you are stuck on a system where
GCC 3.x is the system compiler we recommend using Jikes.
The simplest way to compile this package is:
For building the gtk+ AWT peer JNI native libraries, the following
are required unless --disable-gtk-peer is used as an argument to
configure.
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
- GTK+ 2.8.x (or higher)
- gdk-pixbuf
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
- XTest Extension (libXtst) for GdkRobot support in java.awt.
- There is a bug in earlier versions of at-spi, atk, and gail, which are
used for GNOME accessibility. Prior to version 1.18.0 of these packages,
gtk graphical applications should be run without accessibility (clear the
GTK_MODULES environment variable).
2. Type `make' to compile the package.
For building gcjwebplugin you'll need the Mozilla plugin
support headers and libraries.
3. Optionally, type `make check' to run any self-tests that come with
the package.
The GConf-based backend for java.util.prefs needs the following
library headers:
4. Type `make install' to install the programs and any data files and
documentation.
- gconf 2.11.2 (or higher)
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
For building the Qt AWT peer JNI native libraries you have to
specify --enable-qt-peer and need the following library:
Compilers and Options
=====================
- Qt 4.0.1
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
For building the X AWT peers see information below
(Building and running with the X AWT peers). You will need
the Escher 0.2.3 library:
http://escher.sourceforge.net
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
Please note that at the moment most operating systems do not
ship Qt4 by default. We recommend using GNU Classpath' Qt4
support only for its developers and bug reporters. See
http://developer.classpath.org/mediation/ClasspathShowcase
for details on how to get it to work.
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
For building the xmlj JAXP implementation (disabled by default, use
configure --enable-xmlj) you need the following installed:
- The XML C library for Gnome (libxml2)
http://www.xmlsoft.org/
Minimum version of libxml2 required: 2.6.8
*Note Defining Variables::, for more details.
- The XSLT C library for Gnome (libxslt)
http://www.xmlsoft.org/XSLT/
Minimum version of libxslt required: 1.1.11
Compiling For Multiple Architectures
====================================
For building the documentation you will need
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
- texinfo 4.2 or higher.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
For building the ALSA midi provider code you will need
ALSA. http://www.alsa-project.org.
Installation Names
==================
For building the DSSI midi synthesizer provider code you will
need DSSI from http://dssi.sourceforge.net. This, in turn,
introduces many dependencies, including:
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
- liblo: the Lightweight OSC implementation
http://plugin.org.uk/liblo/
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
- LADSPA: Linux Audio Developer's Simple Plugin API
http://www.ladspa.org
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
- the JACK Audio Connection Kit: A low latency audio server
http://jackit.sourceforge.net
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
- libsndfile: an audio file I/O library
http://www.mega-nerd.com/libsndfile/
Optional Features
=================
- fluidsynth: a real-time SoundFont 2 based soft-synth
http://www.fluidsynth.org/
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For enabling the com.sun.tools.javac support in tools.zip you
will a need jar file containing the Eclipse Java Compiler.
Otherwise com.sun.tools.javac will not be included in tools.zip.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
This package was designed to use the GNU standard for configuration
and makefiles. To build and install do the following:
Specifying the System Type
==========================
1). Run the "configure" script to configure the package. There are
various options you might want to pass to configure to control how the
package is built. Consider the following options, "configure --help"
gives a complete list.
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
--enable-java compile Java source default=yes
--enable-jni compile JNI source default=yes
--enable-gtk-peer compile GTK native peers default=yes
--enable-qt-peer compile Qt4 native peers default=no
--enable-default-toolkit
fully qualified class name of default AWT toolkit
default=no
--enable-xmlj compile native libxml/xslt library default=no
--enable-load-library enable to use JNI native methods default=yes
--enable-local-sockets enable build of local Unix sockets
--with-jikes to compile the class library using jikes
the default is to use gcj
--with-glibj define what to install (zip|flat|both|none)
default=zip
--with-escher=/path/to/escher
enable build of the X/Escher peers, with
the escher library at /path/to/escher, either
in the form of a JAR file, or a directory
containing the .class files of Escher.
--enable-Werror whether to compile C code with -Werror which turns
any compiler warning into a compilation failure
default=no
--with-gjdoc generate documentation using gjdoc default=no
--with-jay Regenerate the parsers with jay must be given the
path to the jay executable
--with-glibj-zip=ABS.PATH
use prebuilt glibj.zip class library
--with-ecj-jar=ABS.PATH specify jar file containing the Eclipse Java
Compiler
CPU-COMPANY-SYSTEM
For more flags run configure --help.
where SYSTEM can have one of these forms:
2). Type "gmake" to build the package. There is no longer a
dependency problem and we aim to keep it that way.
OS KERNEL-OS
3). Type "gmake install" to install everything. This may require
being the superuser. The default install path is /usr/local/classpath
you may change it by giving configure the --prefix=<path> option.
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
Report bugs to classpath@gnu.org or much better via Savannah at this
URL: http://savannah.gnu.org/support/?func=addsupport&group=classpath
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
Happy Hacking!
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Once installed, GNU Classpath is ready to be used by any VM that supports
using the official version of GNU Classpath. Simply ensure that
/usr/local/classpath/share/classpath is in your $CLASSPATH environment
variable. You'll also have to set your LD_LIBRARY_PATH
variable (or similar system configuration) to include the Classpath
native libraries in /usr/local/classpath/lib/classpath.
Sharing Defaults
================
*NOTE* All example paths assume the default prefix is used with configure.
If you don't know what this means then the examples are correct.
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
LD_LIBRARY_PATH=/usr/local/classpath/lib/classpath
CLASSPATH=/usr/local/classpath/share/classpath/glibj.zip:.
export LD_LIBRARY_PATH CLASSPATH
Defining Variables
==================
More information about the VMs that use GNU Classpath can be found in the
README file.
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
------------------------------------------------------------------
Building and running with the X AWT peers
------------------------------------------------------------------
./configure CC=/usr/local2/bin/gcc
In order build the X peers you need the Escher library version 0.2.3
from http://escher.sourceforge.net . Unpack (and optionally build) the
Escher library following the instructions in the downloaded
package. Enable the build of the X peers by passing
--with-escher=/path/to/escher to ./configure where /path/to/escher
either points to a directory structure or JAR file containing the
Escher classes. For Unix systems it is preferable to also build local
socket support by passing --enable-local-sockets, which accelerates
the network communication to the X server significantly.
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). Here is a another example:
In this release you have to enable the X peers at runtime by
setting the system property awt.toolkit=gnu.java.awt.peer.x.XToolkit
by passing -Dawt.toolkit=gnu.java.awt.peer.x.XToolkit to the java
command when running an application.
/bin/bash ./configure CONFIG_SHELL=/bin/bash
------------------------------------------------------------------
Misc. Notes
------------------------------------------------------------------
Compilation is accomplished using a compiler's @file syntax. For our
part, we avoid placing make style dependencies as rules upon the
compilation of a particular class file and leave this up to the Java
compiler instead.
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
The --enable-maintainer-mode option to configure currently does very
little and shouldn't be used by ordinary developers or users anyway.
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
On Windows machines, the native libraries do not currently build, but
the Java bytecode library will. Gcj trunk is beginning to work under
Cygwin. The mingw32 version of jikes cannot follow symbolic links, you
must use a cygwin build of jikes to access this limited functionality.

View File

@ -4,8 +4,9 @@
SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR)
DIST_SUBDIRS = lib doc external include native resource scripts tools examples
# Allow users to pass site-specific flags to autoreconf via an env var.
## GCJ LOCAL: we need an extra -I here.
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config ${LOCAL_AUTORECONF_FLAGS}
native: lib

View File

@ -45,6 +45,8 @@ DIST_COMMON = README $(am__configure_deps) \
$(top_srcdir)/gnu/classpath/Configuration.java.in \
$(top_srcdir)/gnu/java/security/Configuration.java.in \
$(top_srcdir)/resource/META-INF/services/java.util.prefs.PreferencesFactory.in \
$(top_srcdir)/resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader.in \
$(top_srcdir)/resource/META-INF/services/javax.sound.sampled.spi.MixerProvider.in \
../../ABOUT-NLS ../../COPYING ../../COPYING.LIB \
../../ChangeLog ../../README ../../compile ../../config.guess \
../../config.rpath ../../config.sub ../../depcomp \
@ -79,7 +81,9 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CONFIG_HEADER = $(top_builddir)/include/config.h
CONFIG_CLEAN_FILES = gnu/classpath/Configuration.java \
gnu/java/security/Configuration.java \
resource/META-INF/services/java.util.prefs.PreferencesFactory
resource/META-INF/services/java.util.prefs.PreferencesFactory \
resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader \
resource/META-INF/services/javax.sound.sampled.spi.MixerProvider
SOURCES =
DIST_SOURCES =
MULTISRCTOP =
@ -142,6 +146,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@ -180,8 +186,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
@ -205,6 +209,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -277,8 +290,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@
@ -354,7 +365,9 @@ vm_classes = @vm_classes@
# lib first, to compile .class files before native code, last examples
SUBDIRS = lib doc external include native resource scripts tools $(EXAMPLESDIR)
DIST_SUBDIRS = lib doc external include native resource scripts tools examples
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config
# Allow users to pass site-specific flags to autoreconf via an env var.
ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config ${LOCAL_AUTORECONF_FLAGS}
EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE \
ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 ChangeLog-2006 \
ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \
@ -402,6 +415,10 @@ gnu/java/security/Configuration.java: $(top_builddir)/config.status $(top_srcdir
cd $(top_builddir) && $(SHELL) ./config.status $@
resource/META-INF/services/java.util.prefs.PreferencesFactory: $(top_builddir)/config.status $(top_srcdir)/resource/META-INF/services/java.util.prefs.PreferencesFactory.in
cd $(top_builddir) && $(SHELL) ./config.status $@
resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader: $(top_builddir)/config.status $(top_srcdir)/resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader.in
cd $(top_builddir) && $(SHELL) ./config.status $@
resource/META-INF/services/javax.sound.sampled.spi.MixerProvider: $(top_builddir)/config.status $(top_srcdir)/resource/META-INF/services/javax.sound.sampled.spi.MixerProvider.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo

View File

@ -1,3 +1,10 @@
New in release 0.96
Runtime interface changes:
* Add VMFloat.toString(float) and VMFloat.parseFloat(String). Default
implementations are the same as previous behavior.
New in release 0.95 (Apr 23, 2007)
* Full merge of 1.5 generics work.

View File

@ -28,50 +28,9 @@ if $have_libtool ; then : ; else
echo "You must have libtool 1.5 installed to compile $PROJECT."
echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
echo "For Darwin you need the latest stable (1.5.18) to support"
echo "Frameworks linking. Also, you have to point ACLOCAL_FLAGS"
echo "to this libtool/share/aclocal."
DIE=1
fi
have_autoconf=false
if autoconf --version < /dev/null > /dev/null 2>&1 ; then
autoconf_version=`autoconf --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
case $autoconf_version in
2.59* | 2.6[0-9]* )
have_autoconf=true
;;
esac
fi
if $have_autoconf ; then : ; else
echo
echo "You must have autoconf 2.59 or later installed for $PROJECT."
echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
DIE=1
fi
have_automake=false
# We know each 1.9.x version works
if automake-1.9 --version < /dev/null > /dev/null 2>&1 ; then
AUTOMAKE=automake-1.9
ACLOCAL=aclocal-1.9
have_automake=true
elif automake --version < /dev/null > /dev/null 2>&1 ; then
AUTOMAKE=automake
ACLOCAL=aclocal
automake_version=`automake --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
case $automake_version in
1.9* | 1.10*)
have_automake=true
;;
esac
fi
if $have_automake ; then : ; else
echo
echo "You must have automake 1.9 or 1.10 installed to compile $PROJECT."
echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
echo "For Darwin you need the latest stable (1.5.22) to support"
echo "Frameworks linking. Also, you have to point"
echo "LOCAL_AUTORECONF_FLAGS to this libtool/share/aclocal."
DIE=1
fi
@ -91,34 +50,8 @@ if test "x$AUTOGEN_SUBDIR_MODE" = "xyes"; then
fi
fi
if test -z "$ACLOCAL_FLAGS"; then
autoreconf --force --install --warnings=no-portability || exit $?
acdir=`$ACLOCAL --print-ac-dir`
m4list="glib-2.0.m4 glib-gettext.m4"
for file in $m4list
do
if [ ! -f "$acdir/$file" ]; then
echo "WARNING: aclocal's directory is $acdir, but..."
echo " no file $acdir/$file"
echo " You may see fatal macro warnings below."
echo " If these files are installed in /some/dir, set the ACLOCAL_FLAGS "
echo " environment variable to \"-I /some/dir\", or install"
echo " $acdir/$file."
echo ""
fi
done
fi
# Use the "-I m4 flag in order to include pkg.m4 and other .m4 files.
$ACLOCAL -I m4 $ACLOCAL_FLAGS || exit $?
${LIBTOOLIZE} --force || exit $?
autoheader || exit $?
$AUTOMAKE --add-missing || exit $?
autoconf || exit $?
cd $ORIGDIR || exit $?
if test "x$AUTOGEN_SUBDIR_MODE" = "xyes"; then

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ dnl -----------------------------------------------------------
dnl define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl
AC_INIT([GNU Classpath],[0.95],[classpath@gnu.org],[classpath])
AC_INIT([GNU Classpath],[0.96-pre],[classpath@gnu.org],[classpath])
AC_CONFIG_SRCDIR(java/lang/System.java)
dnl GCJ LOCAL
@ -150,10 +150,28 @@ AC_ARG_ENABLE([gconf-peer],
AM_CONDITIONAL(CREATE_GCONF_PEER_LIBRARIES, test "x${COMPILE_GCONF_PEER}" = xyes)
dnl -----------------------------------------------------------
dnl GTK native peer error checking
dnl GConf native peer error checking
dnl -----------------------------------------------------------
AC_ARG_ENABLE([gconf-peers],,AC_MSG_ERROR([No --enable-gconf-peers (or --disable-gconf-peers) option; you want --enable-gconf-peer]))
dnl ------------------------------------------------------------
dnl GStreamer based sound provider backend (disabled by default)
dnl ------------------------------------------------------------
AC_ARG_ENABLE([gstreamer-peer],
[AS_HELP_STRING(--enable-gstreamer-peer,compile GStreamer native peers (disabled by --disable-jni) [default=no])],
[case "${enableval}" in
yes) COMPILE_GSTREAMER_PEER=yes ;;
no) COMPILE_GSTREAMER_PEER=no ;;
*) COMPILE_GSTREAMER_PEER=default ;;
esac],
[COMPILE_GSTREAMER_PEER=default])
AM_CONDITIONAL(CREATE_GSTREAMER_PEER_LIBRARIES, test "x${COMPILE_GSTREAMER_PEER}" = xyes)
dnl -----------------------------------------------------------
dnl GStreamer native peer error checking
dnl -----------------------------------------------------------
AC_ARG_ENABLE([gstreamer-peers],,AC_MSG_ERROR([No --enable-gstreamer-peers (or --disable-gstreamer-peers) option; you want --enable-gstreamer-peer]))
dnl ------------------------------------------------------------
dnl Whether to compile with -Werror or not (disabled by default)
dnl ------------------------------------------------------------
@ -315,7 +333,6 @@ AC_ARG_WITH([vm],
])
AC_SUBST(VM_BINARY)
AM_CONDITIONAL(FOUND_CACAO, test "x`basename $VM_BINARY`" = xcacao)
dnl -----------------------------------------------------------
dnl Regenerate headers at build time (disabled by default)
@ -416,6 +433,7 @@ if test "x${COMPILE_JNI}" = xyes; then
AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
AC_SEARCH_LIBS([inet_pton],[nsl])
AC_CHECK_FUNCS([ftruncate fsync select \
gethostname socket strerror fork pipe execve open close \
lseek fstat read readv write writev htonl memset htons connect \
@ -566,6 +584,39 @@ if test "x${COMPILE_JNI}" = xyes; then
fi
fi
dnl gstreamer-peer
if test "x${COMPILE_GSTREAMER_PEER}" = xyes; then
GST_MAJORMINOR=0.10
GST_REQUIRED=0.10.10
dnl gstreamer
PKG_CHECK_MODULES(GSTREAMER, gstreamer-$GST_MAJORMINOR >= $GST_REQUIRED)
AC_SUBST(GSTREAMER_CFLAGS)
AC_SUBST(GSTREAMER_LIBS)
dnl gstreamer-base
PKG_CHECK_MODULES(GSTREAMER_BASE,
gstreamer-base-$GST_MAJORMINOR >= $GST_REQUIRED)
AC_SUBST(GSTREAMER_BASE_CFLAGS)
AC_SUBST(GSTREAMER_BASE_LIBS)
dnl gstreamer-plugin-base
PKG_CHECK_MODULES(GSTREAMER_PLUGINS_BASE,
gstreamer-plugins-base-$GST_MAJORMINOR >= $GST_REQUIRED)
AC_SUBST(GSTREAMER_PLUGINS_BASE_CFLAGS)
AC_SUBST(GSTREAMER_PLUGINS_BASE_LIBS)
GST_PLUGIN_LDFLAGS='-module -avoid-version -Wno-unused-parameter -no-undefined'
AC_SUBST(GST_PLUGIN_LDFLAGS)
dnl set the gstreamer based file reader, writer and mixer
GSTREAMER_FILE_READER=gnu.javax.sound.sampled.gstreamer.io.GstAudioFileReader
GSTREAMER_MIXER_PROVIDER=gnu.javax.sound.sampled.gstreamer.GStreamerMixerProvider
fi
dnl add the gstreamer resources
AC_SUBST(GSTREAMER_FILE_READER)
AC_SUBST(GSTREAMER_MIXER_PROVIDER)
dnl Check for AWT related Qt4
if test "x${COMPILE_QT_PEER}" = xyes; then
PKG_CHECK_MODULES(QT, QtCore QtGui >= 4.1.0, HAVE_QT4="yes", HAVE_QT4="no")
@ -637,6 +688,17 @@ if test "x${COMPILE_JNI}" = xyes; then
[Define this symbol if you have SO_NOSIGPIPE]) ],
[ AC_MSG_RESULT(no)]
)
dnl **********************************************************************
dnl Check for MSG_WAITALL
dnl **********************************************************************
AC_MSG_CHECKING(for MSG_WAITALL)
AC_TRY_COMPILE([#include <sys/socket.h>],
[ int f = MSG_WAITALL; ],
[ AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_MSG_WAITALL, 1,
[Define this symbol if you have MSG_WAITALL]) ],
[ AC_MSG_RESULT(no)]
)
dnl Check for plugin support headers and libraries.
if test "x${COMPILE_PLUGIN}" = xyes; then
@ -674,7 +736,9 @@ if test "x${COMPILE_JNI}" = xyes; then
fi
fi
CLASSPATH_WITH_JAVAH
if test "x${REGENERATE_JNI_HEADERS}" = xyes; then
CLASSPATH_WITH_JAVAH
fi
dnl -----------------------------------------------------------
dnl Add the include files for the native abstraction layer.
@ -944,6 +1008,7 @@ native/jni/java-nio/Makefile
native/jni/java-util/Makefile
native/jni/gtk-peer/Makefile
native/jni/gconf-peer/Makefile
native/jni/gstreamer-peer/Makefile
native/jni/qt-peer/Makefile
native/jni/xmlj/Makefile
native/jni/midi-alsa/Makefile
@ -952,6 +1017,8 @@ native/jni/native-lib/Makefile
native/plugin/Makefile
resource/Makefile
resource/META-INF/services/java.util.prefs.PreferencesFactory
resource/META-INF/services/javax.sound.sampled.spi.AudioFileReader
resource/META-INF/services/javax.sound.sampled.spi.MixerProvider
scripts/Makefile
scripts/classpath.spec
lib/Makefile

View File

@ -1,10 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2006-10-15.18
scriptversion=2005-07-09.11
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# 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
@ -92,20 +91,7 @@ gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
@ -290,46 +276,6 @@ icc)
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
@ -342,13 +288,13 @@ tru64)
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# static library. This mecanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# compilations output dependencies in in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is

View File

@ -123,6 +123,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@ -161,8 +163,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
@ -186,6 +186,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -258,8 +267,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@

View File

@ -100,6 +100,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@ -138,8 +140,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
@ -163,6 +163,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -235,8 +244,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@

View File

@ -3,11 +3,11 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{2006-10-04.17}
\def\texinfoversion{2005-07-05.19}
%
% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free
% Software Foundation, Inc.
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
% Foundation, Inc.
%
% This texinfo.tex file is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
@ -153,22 +153,28 @@
\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
% Since the category of space is not known, we have to be careful.
\chardef\spacecat = 10
\def\spaceisspace{\catcode`\ =\spacecat}
% sometimes characters are active, so we need control sequences.
% In some macros, we cannot use the `\? notation---the left quote is
% in some cases the escape char.
\chardef\backChar = `\\
\chardef\colonChar = `\:
\chardef\commaChar = `\,
\chardef\dashChar = `\-
\chardef\dotChar = `\.
\chardef\exclamChar= `\!
\chardef\lquoteChar= `\`
\chardef\plusChar = `\+
\chardef\questChar = `\?
\chardef\rquoteChar= `\'
\chardef\semiChar = `\;
\chardef\underChar = `\_
\chardef\spaceChar = `\ %
\chardef\spacecat = 10
\def\spaceisspace{\catcode\spaceChar=\spacecat}
{% for help with debugging.
% example usage: \expandafter\show\activebackslash
\catcode`\! = 0 \catcode`\\ = \active
!global!def!activebackslash{\}
}
% Ignore a token.
%
\def\gobble#1{}
@ -305,13 +311,6 @@
% before the \shipout runs.
%
\indexdummies % don't expand commands in the output.
\normalturnoffactive % \ in index entries must not stay \, e.g., if
% the page break happens to be in the middle of an example.
% We don't want .vr (or whatever) entries like this:
% \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}}
% "\acronym" won't work when it's read back in;
% it needs to be
% {\code {{\tt \backslashcurfont }acronym}
\shipout\vbox{%
% Do this early so pdf references go to the beginning of the page.
\ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
@ -339,9 +338,9 @@
\pagebody{#1}%
\ifdim\ht\footlinebox > 0pt
% Only leave this space if the footline is nonempty.
% (We lessened \vsize for it in \oddfootingyyy.)
% (We lessened \vsize for it in \oddfootingxxx.)
% The \baselineskip=24pt in plain's \makefootline has no effect.
\vskip 24pt
\vskip 2\baselineskip
\unvbox\footlinebox
\fi
%
@ -397,7 +396,7 @@
%
\def\parsearg{\parseargusing{}}
\def\parseargusing#1#2{%
\def\argtorun{#2}%
\def\next{#2}%
\begingroup
\obeylines
\spaceisspace
@ -428,7 +427,8 @@
\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
\def\temp{#3}%
\ifx\temp\empty
% Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
% We cannot use \next here, as it holds the macro to run;
% thus we reuse \temp.
\let\temp\finishparsearg
\else
\let\temp\argcheckspaces
@ -440,14 +440,14 @@
% If a _delimited_ argument is enclosed in braces, they get stripped; so
% to get _exactly_ the rest of the line, we had to prevent such situation.
% We prepended an \empty token at the very beginning and we expand it now,
% just before passing the control to \argtorun.
% just before passing the control to \next.
% (Similarily, we have to think about #3 of \argcheckspacesY above: it is
% either the null string, or it ends with \^^M---thus there is no danger
% that a pair of braces would be stripped.
%
% But first, we have to remove the trailing space token.
%
\def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}}
% \parseargdef\foo{...}
% is roughly equivalent to
@ -1051,9 +1051,9 @@ where each line of input produces a line of output.}
% _ active, and distinguish by seeing if the current family is \slfam,
% which is what @var uses.
{
\catcode`\_ = \active
\catcode\underChar = \active
\gdef\mathunderscore{%
\catcode`\_=\active
\catcode\underChar=\active
\def_{\ifnum\fam=\slfam \_\else\sb\fi}%
}
}
@ -1096,24 +1096,15 @@ where each line of input produces a line of output.}
\def\minus{$-$}
% @dots{} outputs an ellipsis using the current font.
% We do .5em per period so that it has the same spacing in the cm
% typewriter fonts as three actual period characters; on the other hand,
% in other typewriter fonts three periods are wider than 1.5em. So do
% whichever is larger.
% We do .5em per period so that it has the same spacing in a typewriter
% font as three actual period characters.
%
\def\dots{%
\leavevmode
\setbox0=\hbox{...}% get width of three periods
\ifdim\wd0 > 1.5em
\dimen0 = \wd0
\else
\dimen0 = 1.5em
\fi
\hbox to \dimen0{%
\hskip 0pt plus.25fil
.\hskip 0pt plus1fil
.\hskip 0pt plus1fil
.\hskip 0pt plus.5fil
\hbox to 1.5em{%
\hskip 0pt plus 0.25fil
.\hfil.\hfil.%
\hskip 0pt plus 0.5fil
}%
}
@ -1206,20 +1197,21 @@ where each line of input produces a line of output.}
\fi
\fi
% PDF uses PostScript string constants for the names of xref targets,
% PDF uses PostScript string constants for the names of xref targets, to
% for display in the outlines, and in other places. Thus, we have to
% double any backslashes. Otherwise, a name like "\node" will be
% interpreted as a newline (\n), followed by o, d, e. Not good.
% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html
% (and related messages, the final outcome is that it is up to the TeX
% user to double the backslashes and otherwise make the string valid, so
% that's what we do).
% that's we do).
% double active backslashes.
%
{\catcode`\@=0 \catcode`\\=\active
@gdef@activebackslash{@catcode`@\=@active @otherbackslash}
@gdef@activebackslashdouble{%
@catcode`@\=@active
@catcode@backChar=@active
@let\=@doublebackslash}
}
@ -1251,17 +1243,21 @@ where each line of input produces a line of output.}
\def\backslashparens#1{%
\xdef#1{#1}% redefine it as its expansion; the definition is simply
% \lastnode when called from \setref -> \pdfmkdest.
\HyPsdSubst{(}{\realbackslash(}{#1}%
\HyPsdSubst{)}{\realbackslash)}{#1}%
\HyPsdSubst{(}{\backslashlparen}{#1}%
\HyPsdSubst{)}{\backslashrparen}{#1}%
}
{\catcode\exclamChar = 0 \catcode\backChar = \other
!gdef!backslashlparen{\(}%
!gdef!backslashrparen{\)}%
}
\ifpdf
\input pdfcolor
\pdfcatalog{/PageMode /UseOutlines}%
% #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
\def\dopdfimage#1#2#3{%
\def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
\def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
\def\imagewidth{#2}%
\def\imageheight{#3}%
% without \immediate, pdftex seg faults when the same image is
% included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
\ifnum\pdftexversion < 14
@ -1269,8 +1265,8 @@ where each line of input produces a line of output.}
\else
\immediate\pdfximage
\fi
\ifdim \wd0 >0pt width \imagewidth \fi
\ifdim \wd2 >0pt height \imageheight \fi
\ifx\empty\imagewidth\else width \imagewidth \fi
\ifx\empty\imageheight\else height \imageheight \fi
\ifnum\pdftexversion<13
#1.pdf%
\else
@ -1394,7 +1390,7 @@ where each line of input produces a line of output.}
% now, I guess we'll just let the pdf reader have its way.
\indexnofonts
\setupdatafile
\catcode`\\=\active \otherbackslash
\activebackslash
\input \jobname.toc
\endgroup
}
@ -1413,17 +1409,9 @@ where each line of input produces a line of output.}
\else
\let \startlink \pdfstartlink
\fi
% make a live url in pdf output.
\def\pdfurl#1{%
\begingroup
% it seems we really need yet another set of dummies; have not
% tried to figure out what each command should do in the context
% of @url. for now, just make @/ a no-op, that's the only one
% people have actually reported a problem with.
%
\normalturnoffactive
\def\@{@}%
\let\/=\empty
\normalturnoffactive\def\@{@}%
\makevalueexpandable
\leavevmode\Red
\startlink attr{/Border [0 0 0]}%
@ -1493,7 +1481,6 @@ where each line of input produces a line of output.}
% We don't need math for this font style.
\def\ttsl{\setfontstyle{ttsl}}
% Default leading.
\newdimen\textleading \textleading = 13.2pt
@ -1515,13 +1502,11 @@ where each line of input produces a line of output.}
}%
}
% Set the font macro #1 to the font named #2, adding on the
% specified font prefix (normally `cm').
% #3 is the font's design size, #4 is a scale factor
\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
% Use cm as the default font prefix.
% To specify the font prefix, you must define \fontprefix
% before you read in texinfo.tex.
@ -1545,10 +1530,6 @@ where each line of input produces a line of output.}
\def\scshape{csc}
\def\scbshape{csc}
% Definitions for a main text size of 11pt. This is the default in
% Texinfo.
%
\def\definetextfontsizexi{
% Text fonts (11.2pt, magstep1).
\def\textnominalsize{11pt}
\edef\mainmagstep{\magstephalf}
@ -1662,165 +1643,6 @@ where each line of input produces a line of output.}
\font\reducedi=cmmi10
\font\reducedsy=cmsy10
% reset the current fonts
\textfonts
\rm
} % end of 11pt text font size definitions
% Definitions to make the main text be 10pt Computer Modern, with
% section, chapter, etc., sizes following suit. This is for the GNU
% Press printing of the Emacs 22 manual. Maybe other manuals in the
% future. Used with @smallbook, which sets the leading to 12pt.
%
\def\definetextfontsizex{%
% Text fonts (10pt).
\def\textnominalsize{10pt}
\edef\mainmagstep{1000}
\setfont\textrm\rmshape{10}{\mainmagstep}
\setfont\texttt\ttshape{10}{\mainmagstep}
\setfont\textbf\bfshape{10}{\mainmagstep}
\setfont\textit\itshape{10}{\mainmagstep}
\setfont\textsl\slshape{10}{\mainmagstep}
\setfont\textsf\sfshape{10}{\mainmagstep}
\setfont\textsc\scshape{10}{\mainmagstep}
\setfont\textttsl\ttslshape{10}{\mainmagstep}
\font\texti=cmmi10 scaled \mainmagstep
\font\textsy=cmsy10 scaled \mainmagstep
% A few fonts for @defun names and args.
\setfont\defbf\bfshape{10}{\magstephalf}
\setfont\deftt\ttshape{10}{\magstephalf}
\setfont\defttsl\ttslshape{10}{\magstephalf}
\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf}
% Fonts for indices, footnotes, small examples (9pt).
\def\smallnominalsize{9pt}
\setfont\smallrm\rmshape{9}{1000}
\setfont\smalltt\ttshape{9}{1000}
\setfont\smallbf\bfshape{10}{900}
\setfont\smallit\itshape{9}{1000}
\setfont\smallsl\slshape{9}{1000}
\setfont\smallsf\sfshape{9}{1000}
\setfont\smallsc\scshape{10}{900}
\setfont\smallttsl\ttslshape{10}{900}
\font\smalli=cmmi9
\font\smallsy=cmsy9
% Fonts for small examples (8pt).
\def\smallernominalsize{8pt}
\setfont\smallerrm\rmshape{8}{1000}
\setfont\smallertt\ttshape{8}{1000}
\setfont\smallerbf\bfshape{10}{800}
\setfont\smallerit\itshape{8}{1000}
\setfont\smallersl\slshape{8}{1000}
\setfont\smallersf\sfshape{8}{1000}
\setfont\smallersc\scshape{10}{800}
\setfont\smallerttsl\ttslshape{10}{800}
\font\smalleri=cmmi8
\font\smallersy=cmsy8
% Fonts for title page (20.4pt):
\def\titlenominalsize{20pt}
\setfont\titlerm\rmbshape{12}{\magstep3}
\setfont\titleit\itbshape{10}{\magstep4}
\setfont\titlesl\slbshape{10}{\magstep4}
\setfont\titlett\ttbshape{12}{\magstep3}
\setfont\titlettsl\ttslshape{10}{\magstep4}
\setfont\titlesf\sfbshape{17}{\magstep1}
\let\titlebf=\titlerm
\setfont\titlesc\scbshape{10}{\magstep4}
\font\titlei=cmmi12 scaled \magstep3
\font\titlesy=cmsy10 scaled \magstep4
\def\authorrm{\secrm}
\def\authortt{\sectt}
% Chapter fonts (14.4pt).
\def\chapnominalsize{14pt}
\setfont\chaprm\rmbshape{12}{\magstep1}
\setfont\chapit\itbshape{10}{\magstep2}
\setfont\chapsl\slbshape{10}{\magstep2}
\setfont\chaptt\ttbshape{12}{\magstep1}
\setfont\chapttsl\ttslshape{10}{\magstep2}
\setfont\chapsf\sfbshape{12}{\magstep1}
\let\chapbf\chaprm
\setfont\chapsc\scbshape{10}{\magstep2}
\font\chapi=cmmi12 scaled \magstep1
\font\chapsy=cmsy10 scaled \magstep2
% Section fonts (12pt).
\def\secnominalsize{12pt}
\setfont\secrm\rmbshape{12}{1000}
\setfont\secit\itbshape{10}{\magstep1}
\setfont\secsl\slbshape{10}{\magstep1}
\setfont\sectt\ttbshape{12}{1000}
\setfont\secttsl\ttslshape{10}{\magstep1}
\setfont\secsf\sfbshape{12}{1000}
\let\secbf\secrm
\setfont\secsc\scbshape{10}{\magstep1}
\font\seci=cmmi12
\font\secsy=cmsy10 scaled \magstep1
% Subsection fonts (10pt).
\def\ssecnominalsize{10pt}
\setfont\ssecrm\rmbshape{10}{1000}
\setfont\ssecit\itbshape{10}{1000}
\setfont\ssecsl\slbshape{10}{1000}
\setfont\ssectt\ttbshape{10}{1000}
\setfont\ssecttsl\ttslshape{10}{1000}
\setfont\ssecsf\sfbshape{10}{1000}
\let\ssecbf\ssecrm
\setfont\ssecsc\scbshape{10}{1000}
\font\sseci=cmmi10
\font\ssecsy=cmsy10
% Reduced fonts for @acro in text (9pt).
\def\reducednominalsize{9pt}
\setfont\reducedrm\rmshape{9}{1000}
\setfont\reducedtt\ttshape{9}{1000}
\setfont\reducedbf\bfshape{10}{900}
\setfont\reducedit\itshape{9}{1000}
\setfont\reducedsl\slshape{9}{1000}
\setfont\reducedsf\sfshape{9}{1000}
\setfont\reducedsc\scshape{10}{900}
\setfont\reducedttsl\ttslshape{10}{900}
\font\reducedi=cmmi9
\font\reducedsy=cmsy9
% reduce space between paragraphs
\divide\parskip by 2
% reset the current fonts
\textfonts
\rm
} % end of 10pt text font size definitions
% We provide the user-level command
% @fonttextsize 10
% (or 11) to redefine the text font size. pt is assumed.
%
\def\xword{10}
\def\xiword{11}
%
\parseargdef\fonttextsize{%
\def\textsizearg{#1}%
\wlog{doing @fonttextsize \textsizearg}%
%
% Set \globaldefs so that documents can use this inside @tex, since
% makeinfo 4.8 does not support it, but we need it nonetheless.
%
\begingroup \globaldefs=1
\ifx\textsizearg\xword \definetextfontsizex
\else \ifx\textsizearg\xiword \definetextfontsizexi
\else
\errhelp=\EMsimple
\errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
\fi\fi
\endgroup
}
% In order for the font changes to affect most math symbols and letters,
% we have to define the \textfont of the standard families. Since
% texinfo doesn't allow for producing subscripts and superscripts except
@ -1931,7 +1753,7 @@ where each line of input produces a line of output.}
% Set up the default fonts, so we can use them for creating boxes.
%
\definetextfontsizexi
\textfonts \rm
% Define these so they can be easily changed for other fonts.
\def\angleleft{$\langle$}
@ -2056,14 +1878,11 @@ where each line of input produces a line of output.}
% and arrange explicitly to hyphenate at a dash.
% -- rms.
{
\catcode`\-=\active \catcode`\_=\active
\catcode`\'=\active \catcode`\`=\active
\catcode`\-=\active
\catcode`\_=\active
%
\global\def\code{\begingroup
\catcode\rquoteChar=\active \catcode\lquoteChar=\active
\let'\codequoteright \let`\codequoteleft
%
\catcode\dashChar=\active \catcode\underChar=\active
\catcode`\-=\active \catcode`\_=\active
\ifallowcodebreaks
\let-\codedash
\let_\codeunder
@ -2309,10 +2128,6 @@ where each line of input produces a line of output.}
}$%
}
% @textdegree - the normal degrees sign.
%
\def\textdegree{$^\circ$}
% Laurent Siebenmann reports \Orb undefined with:
% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
% so we'll define it if necessary.
@ -2484,8 +2299,8 @@ where each line of input produces a line of output.}
%
% Leave some space for the footline. Hopefully ok to assume
% @evenfooting will not be used by itself.
\global\advance\pageheight by -12pt
\global\advance\vsize by -12pt
\global\advance\pageheight by -\baselineskip
\global\advance\vsize by -\baselineskip
}
\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
@ -3144,7 +2959,6 @@ where each line of input produces a line of output.}
\def\doignore#1{\begingroup
% Scan in ``verbatim'' mode:
\obeylines
\catcode`\@ = \other
\catcode`\{ = \other
\catcode`\} = \other
@ -3165,16 +2979,16 @@ where each line of input produces a line of output.}
\gdef\dodoignore#1{%
% #1 contains the command name as a string, e.g., `ifinfo'.
%
% Define a command to find the next `@end #1'.
\long\def\doignoretext##1^^M@end #1{%
\doignoretextyyy##1^^M@#1\_STOP_}%
%
% Define a command to find the next `@end #1', which must be on a line
% by itself.
\long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}%
% And this command to find another #1 command, at the beginning of a
% line. (Otherwise, we would consider a line `@c @ifset', for
% example, to count as an @ifset for nesting.)
\long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
%
% And now expand that command.
\obeylines %
\doignoretext ^^M%
}%
}
@ -3204,12 +3018,7 @@ where each line of input produces a line of output.}
}
% Finish off ignored text.
{ \obeylines%
% Ignore anything after the last `@end #1'; this matters in verbatim
% environments, where otherwise the newline after an ignored conditional
% would result in a blank line in the output.
\gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
}
\def\enddoignore{\endgroup\ignorespaces}
% @set VAR sets the variable VAR to an empty value.
@ -3412,39 +3221,12 @@ where each line of input produces a line of output.}
\escapechar = `\\ % use backslash in output files.
\def\@{@}% change to @@ when we switch to @ as escape char in index files.
\def\ {\realbackslash\space }%
%
% Need these in case \tex is in effect and \{ is a \delimiter again.
% But can't use \lbracecmd and \rbracecmd because texindex assumes
% braces and backslashes are used only as delimiters.
\let\{ = \mylbrace
\let\} = \myrbrace
%
% I don't entirely understand this, but when an index entry is
% generated from a macro call, the \endinput which \scanmacro inserts
% causes processing to be prematurely terminated. This is,
% apparently, because \indexsorttmp is fully expanded, and \endinput
% is an expandable command. The redefinition below makes \endinput
% disappear altogether for that purpose -- although logging shows that
% processing continues to some further point. On the other hand, it
% seems \endinput does not hurt in the printed index arg, since that
% is still getting written without apparent harm.
%
% Sample source (mac-idx3.tex, reported by Graham Percival to
% help-texinfo, 22may06):
% @macro funindex {WORD}
% @findex xyz
% @end macro
% ...
% @funindex commtest
%
% The above is not enough to reproduce the bug, but it gives the flavor.
%
% Sample whatsit resulting:
% .@write3{\entry{xyz}{@folio }{@code {xyz@endinput }}}
%
% So:
\let\endinput = \empty
%
% Do the redefinitions.
\commondummies
}
@ -3462,7 +3244,6 @@ where each line of input produces a line of output.}
%
% Do the redefinitions.
\commondummies
\otherbackslash
}
% Called from \indexdummies and \atdummies.
@ -3536,7 +3317,6 @@ where each line of input produces a line of output.}
\definedummyword\point
\definedummyword\print
\definedummyword\result
\definedummyword\textdegree
%
% We want to disable all macros so that they are not expanded by \write.
\macrolist
@ -3550,62 +3330,63 @@ where each line of input produces a line of output.}
% \commondummiesnofonts: common to \commondummies and \indexnofonts.
%
\def\commondummiesnofonts{%
% Control letters and accents.
\definedummyletter\!%
\definedummyaccent\"%
\definedummyaccent\'%
\definedummyletter\*%
\definedummyaccent\,%
\definedummyletter\.%
\definedummyletter\/%
\definedummyletter\:%
\definedummyaccent\=%
\definedummyletter\?%
\definedummyaccent\^%
\definedummyaccent\`%
\definedummyaccent\~%
\definedummyword\u
\definedummyword\v
\definedummyword\H
\definedummyword\dotaccent
\definedummyword\ringaccent
\definedummyword\tieaccent
\definedummyword\ubaraccent
\definedummyword\udotaccent
\definedummyword\dotless
%
% Texinfo font commands.
\definedummyword\b
\definedummyword\i
\definedummyword\r
\definedummyword\sc
\definedummyword\t
%
% Commands that take arguments.
\definedummyword\acronym
\definedummyword\cite
\definedummyword\code
\definedummyword\command
\definedummyword\dfn
\definedummyword\emph
\definedummyword\env
\definedummyword\file
\definedummyword\kbd
\definedummyword\key
\definedummyword\math
\definedummyword\option
\definedummyword\pxref
\definedummyword\ref
\definedummyword\samp
\definedummyword\strong
\definedummyword\tie
\definedummyword\uref
\definedummyword\url
\definedummyword\var
\definedummyword\verb
\definedummyword\w
\definedummyword\xref
% Better have this without active chars.
{
\catcode`\~=\other
\gdef\commondummiesnofonts{%
% Control letters and accents.
\definedummyletter\!%
\definedummyaccent\"%
\definedummyaccent\'%
\definedummyletter\*%
\definedummyaccent\,%
\definedummyletter\.%
\definedummyletter\/%
\definedummyletter\:%
\definedummyaccent\=%
\definedummyletter\?%
\definedummyaccent\^%
\definedummyaccent\`%
\definedummyaccent\~%
\definedummyword\u
\definedummyword\v
\definedummyword\H
\definedummyword\dotaccent
\definedummyword\ringaccent
\definedummyword\tieaccent
\definedummyword\ubaraccent
\definedummyword\udotaccent
\definedummyword\dotless
%
% Texinfo font commands.
\definedummyword\b
\definedummyword\i
\definedummyword\r
\definedummyword\sc
\definedummyword\t
%
% Commands that take arguments.
\definedummyword\acronym
\definedummyword\cite
\definedummyword\code
\definedummyword\command
\definedummyword\dfn
\definedummyword\emph
\definedummyword\env
\definedummyword\file
\definedummyword\kbd
\definedummyword\key
\definedummyword\math
\definedummyword\option
\definedummyword\samp
\definedummyword\strong
\definedummyword\tie
\definedummyword\uref
\definedummyword\url
\definedummyword\var
\definedummyword\verb
\definedummyword\w
}
}
% \indexnofonts is used when outputting the strings to sort the index
@ -3670,7 +3451,6 @@ where each line of input produces a line of output.}
\def\point{.}%
\def\print{-|}%
\def\result{=>}%
\def\textdegree{degrees}%
%
% We need to get rid of all macros, leaving only the arguments (if present).
% Of course this is not nearly correct, but it is the best we can do for now.
@ -4019,9 +3799,9 @@ where each line of input produces a line of output.}
\endgroup
}
% Like plain.tex's \dotfill, except uses up at least 1 em.
% Like \dotfill except takes at least 1 em.
\def\indexdotfill{\cleaders
\hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1fill}
\hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
\def\primary #1{\line{#1\hfil}}
@ -4595,17 +4375,14 @@ where each line of input produces a line of output.}
\ifx\temptype\Ynothingkeyword
\setbox0 = \hbox{}%
\def\toctype{unnchap}%
\gdef\thischapternum{}%
\gdef\thischapter{#1}%
\else\ifx\temptype\Yomitfromtockeyword
\setbox0 = \hbox{}% contents like unnumbered, but no toc entry
\def\toctype{omit}%
\gdef\thischapternum{}%
\gdef\thischapter{}%
\else\ifx\temptype\Yappendixkeyword
\setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
\def\toctype{app}%
\xdef\thischapternum{\appendixletter}%
% We don't substitute the actual chapter name into \thischapter
% because we don't want its macros evaluated now. And we don't
% use \thissection because that changes with each section.
@ -4615,7 +4392,6 @@ where each line of input produces a line of output.}
\else
\setbox0 = \hbox{#3\enspace}%
\def\toctype{numchap}%
\xdef\thischapternum{\the\chapno}%
\xdef\thischapter{\putwordChapter{} \the\chapno:
\noexpand\thischaptername}%
\fi\fi\fi
@ -4727,21 +4503,13 @@ where each line of input produces a line of output.}
\gdef\thissection{#1}%
\fi\fi\fi
%
% Write the toc entry (before \donoderef). See comments in \chapmacro.
% Write the toc entry (before \donoderef). See comments in \chfplain.
\writetocentry{\toctype\sectionlevel}{#1}{#4}%
%
% Write the node reference (= pdf destination for pdftex).
% Again, see comments in \chapmacro.
% Again, see comments in \chfplain.
\donoderef{#3}%
%
% Interline glue will be inserted when the vbox is completed.
% That glue will be a valid breakpoint for the page, since it'll be
% preceded by a whatsit (usually from the \donoderef, or from the
% \writetocentry if there was no node). We don't want to allow that
% break, since then the whatsits could end up on page n while the
% section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
\nobreak
%
% Output the actual section heading.
\vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
\hangindent=\wd0 % zero if no section number
@ -4804,7 +4572,7 @@ where each line of input produces a line of output.}
\edef\temp{%
\write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
\temp
}%
}
\fi
\fi
%
@ -5056,7 +4824,7 @@ where each line of input produces a line of output.}
{\tentt \global\dimen0 = 3em}% Width of the box.
\dimen2 = .55pt % Thickness of rules
% The text. (`r' is open on the right, `e' somewhat less so on the left.)
\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt}
\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
%
\setbox\errorbox=\hbox to \dimen0{\hfil
\hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
@ -5279,10 +5047,11 @@ where each line of input produces a line of output.}
%
\maketwodispenvs {lisp}{example}{%
\nonfillstart
\tt\quoteexpand
\tt
\let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
\gobble % eat return
}
% @display/@smalldisplay: same as @lisp except keep current font.
%
\makedispenv {display}{%
@ -5410,34 +5179,6 @@ where each line of input produces a line of output.}
\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
%
\def\starttabbox{\setbox0=\hbox\bgroup}
% Allow an option to not replace quotes with a regular directed right
% quote/apostrophe (char 0x27), but instead use the undirected quote
% from cmtt (char 0x0d). The undirected quote is ugly, so don't make it
% the default, but it works for pasting with more pdf viewers (at least
% evince), the lilypond developers report. xpdf does work with the
% regular 0x27.
%
\def\codequoteright{%
\expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
'%
\else
\char'15
\fi
}
%
% and a similar option for the left quote char vs. a grave accent.
% Modern fonts display ASCII 0x60 as a grave accent, so some people like
% the code environments to do likewise.
%
\def\codequoteleft{%
\expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
`%
\else
\char'22
\fi
}
%
\begingroup
\catcode`\^^I=\active
\gdef\tabexpand{%
@ -5450,16 +5191,7 @@ where each line of input produces a line of output.}
\wd0=\dimen0 \box0 \starttabbox
}%
}
\catcode`\'=\active
\gdef\rquoteexpand{\catcode\rquoteChar=\active \def'{\codequoteright}}%
%
\catcode`\`=\active
\gdef\lquoteexpand{\catcode\lquoteChar=\active \def`{\codequoteleft}}%
%
\gdef\quoteexpand{\rquoteexpand \lquoteexpand}%
\endgroup
% start the verbatim environment.
\def\setupverbatim{%
\let\nonarrowing = t%
\nonfillstart
@ -5468,7 +5200,6 @@ where each line of input produces a line of output.}
\def\par{\leavevmode\egroup\box0\endgraf}%
\catcode`\`=\active
\tabexpand
\quoteexpand
% Respect line breaks,
% print special symbols as themselves, and
% make each space count
@ -5918,6 +5649,7 @@ where each line of input produces a line of output.}
\spaceisspace
%
% Append \endinput to make sure that TeX does not see the ending newline.
%
% I've verified that it is necessary both for e-TeX and for ordinary TeX
% --kasal, 29nov03
\scantokens{#1\endinput}%
@ -6184,11 +5916,11 @@ where each line of input produces a line of output.}
% {. If so it reads up to the closing }, if not, it reads the whole
% line. Whatever was read is then fed to the next control sequence
% as an argument (by \parsebrace or \parsearg)
\def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
\def\braceorlinexxx{%
\ifx\nchar\bgroup\else
\expandafter\parsearg
\fi \macnamexxx}
\fi \next}
% @alias.
@ -6353,7 +6085,7 @@ where each line of input produces a line of output.}
% If the user specified the print name (third arg) to the ref,
% print it instead of our usual "Figure 1.2".
\ifdim\wd0 = 0pt
\refx{#1-snt}{}%
\refx{#1-snt}%
\else
\printedrefname
\fi
@ -6783,7 +6515,7 @@ where each line of input produces a line of output.}
% above and below.
\nobreak\vskip\parskip
\nobreak
\line\bgroup
\line\bgroup\hss
\fi
%
% Output the image.
@ -6796,7 +6528,7 @@ where each line of input produces a line of output.}
\epsfbox{#1.eps}%
\fi
%
\ifimagevmode \egroup \bigbreak \fi % space after the image
\ifimagevmode \hss \egroup \bigbreak \fi % space after the image
\endgroup}
@ -6937,7 +6669,6 @@ where each line of input produces a line of output.}
% caption if specified, else the full caption if specified, else nothing.
{%
\atdummies
%
% since we read the caption text in the macro world, where ^^M
% is turned into a normal character, we have to scan it back, so
% we don't write the literal three characters "^^M" into the aux file.
@ -6958,9 +6689,8 @@ where each line of input produces a line of output.}
%
% place the captured inserts
%
% BEWARE: when the floats start floating, we have to issue warning
% whenever an insert appears inside a float which could possibly
% float. --kasal, 26may04
% BEWARE: when the floats start float, we have to issue warning whenever an
% insert appears inside a float which could possibly float. --kasal, 26may04
%
\checkinserts
}
@ -7387,13 +7117,6 @@ should work if nowhere else does.}
% \otherifyactive is called near the end of this file.
\def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
% Used sometimes to turn off (effectively) the active characters even after
% parsing them.
\def\turnoffactive{%
\normalturnoffactive
\otherbackslash
}
\catcode`\@=0
% \backslashcurfont outputs one backslash character in current font,
@ -7401,29 +7124,28 @@ should work if nowhere else does.}
\global\chardef\backslashcurfont=`\\
\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
% \rawbackslash defines an active \ to do \backslashcurfont.
% \otherbackslash defines an active \ to be a literal `\' character with
% catcode other.
{\catcode`\\=\active
@gdef@rawbackslash{@let\=@backslashcurfont}
@gdef@otherbackslash{@let\=@realbackslash}
}
% \realbackslash is an actual character `\' with catcode other, and
% \doublebackslash is two of them (for the pdf outlines).
{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
% In texinfo, backslash is an active character; it prints the backslash
% in fixed width font.
% \normalbackslash outputs one backslash in fixed width font.
\def\normalbackslash{{\tt\backslashcurfont}}
\catcode`\\=\active
@def@normalbackslash{{@tt@backslashcurfont}}
% On startup, @fixbackslash assigns:
% @let \ = @normalbackslash
% \rawbackslash defines an active \ to do \backslashcurfont.
% \otherbackslash defines an active \ to be a literal `\' character with
% catcode other.
@gdef@rawbackslash{@let\=@backslashcurfont}
@gdef@otherbackslash{@let\=@realbackslash}
% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
% the literal character `\'.
%
@def@normalturnoffactive{%
@let\=@normalbackslash
% Used sometimes to turn off (effectively) the active characters
% even after parsing them.
@def@turnoffactive{%
@let"=@normaldoublequote
@let\=@realbackslash
@let~=@normaltilde
@let^=@normalcaret
@let_=@normalunderscore
@ -7435,6 +7157,12 @@ should work if nowhere else does.}
@unsepspaces
}
% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
% the literal character `\'. (Thus, \ is not expandable when this is in
% effect.)
%
@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
% Make _ and + \other characters, temporarily.
% This is canceled by @fixbackslash.
@otherifyactive
@ -7447,7 +7175,7 @@ should work if nowhere else does.}
@global@let\ = @eatinput
% On the other hand, perhaps the file did not have a `\input texinfo'. Then
% the first `\' in the file would cause an error. This macro tries to fix
% the first `\{ in the file would cause an error. This macro tries to fix
% that, assuming it is called before the first `\' could plausibly occur.
% Also turn back on active characters that might appear in the input
% file name, in case not using a pre-dumped format.

View File

@ -109,6 +109,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@ -147,8 +149,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
@ -172,6 +172,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -244,8 +253,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@

View File

@ -20,17 +20,28 @@ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
package gnu.classpath.examples.awt;
import gnu.java.awt.font.*;
import gnu.java.awt.font.opentype.*;
import gnu.java.awt.font.FontDelegate;
import gnu.java.awt.font.GNUGlyphVector;
import gnu.java.awt.font.opentype.OpenTypeFontFactory;
import java.awt.*;
import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.font.*;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import java.text.*;
import java.awt.font.FontRenderContext;
import java.io.File;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.text.StringCharacterIterator;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
@ -57,6 +68,9 @@ public class HintingDemo extends JFrame {
char character;
Options options;
boolean antiAlias;
boolean showGrid;
boolean showOriginal;
boolean showHinted;
int flags;
class StringViewer extends JPanel
@ -133,24 +147,35 @@ public class HintingDemo extends JFrame {
Insets i = getInsets();
g2d.clearRect(i.left, i.top, getWidth() - i.left - i.right,
getHeight() - i.top - i.bottom);
g2d.setColor(Color.GRAY);
for (int x = 20; x < getWidth(); x += 20)
if (showGrid)
{
g2d.drawLine(x, i.top, x, getHeight() - i.top - i.bottom);
g2d.setColor(Color.GRAY);
for (int x = 20; x < getWidth(); x += 20)
{
g2d.drawLine(x, i.top, x, getHeight() - i.top - i.bottom);
}
for (int y = 20; y < getHeight(); y += 20)
{
g2d.drawLine(i.left, y, getWidth() - i.left - i.right, y);
}
}
for (int y = 20; y < getHeight(); y += 20)
{
g2d.drawLine(i.left, y, getWidth() - i.left - i.right, y);
}
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
// RenderingHints.VALUE_ANTIALIAS_ON);
g2d.translate(40, 300);
g2d.scale(20., 20.);
g2d.setStroke(new BasicStroke((float) (1/20.)));
g2d.setColor(Color.RED);
g2d.draw(glyph.getOutline(0, 0, flags & ~FontDelegate.FLAG_FITTED));
g2d.setColor(Color.GREEN);
g2d.draw(glyph.getOutline(0, 0, flags | FontDelegate.FLAG_FITTED));
g2d.setStroke(new BasicStroke((float) (1/10.)));
if (showOriginal)
{
g2d.setColor(Color.RED);
g2d.draw(glyph.getOutline(0, 0,
flags & ~FontDelegate.FLAG_FITTED));
}
if (showHinted)
{
g2d.setColor(Color.RED);
g2d.draw(glyph.getOutline(0, 0,
flags | FontDelegate.FLAG_FITTED));
}
}
}
@ -186,7 +211,7 @@ public class HintingDemo extends JFrame {
HintingDemo()
{
File file = new File("/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType/DejaVuSerif.ttf");
File file = new File("/usr/share/fonts/truetype/freefont/FreeSans.ttf");
loadFont(file);
setLayout(new BorderLayout());
chooser = new Chooser();
@ -244,6 +269,9 @@ public class HintingDemo extends JFrame {
implements ActionListener
{
JCheckBox antiAliasOpt;
JCheckBox showGridOpt;
JCheckBox showOriginalOpt;
JCheckBox showHintedOpt;
JCheckBox hintHorizontalOpt;
JCheckBox hintVerticalOpt;
JCheckBox hintEdgeOpt;
@ -257,6 +285,18 @@ public class HintingDemo extends JFrame {
antiAliasOpt.setSelected(true);
antiAliasOpt.addActionListener(this);
add(antiAliasOpt);
showGridOpt = new JCheckBox("Show grid");
showGridOpt.setSelected(true);
showGridOpt.addActionListener(this);
add(showGridOpt);
showOriginalOpt = new JCheckBox("Show original");
showOriginalOpt.setSelected(true);
showOriginalOpt.addActionListener(this);
add(showOriginalOpt);
showHintedOpt = new JCheckBox("Show hinted");
showHintedOpt.setSelected(true);
showHintedOpt.addActionListener(this);
add(showHintedOpt);
hintHorizontalOpt = new JCheckBox("Hint horizontal");
hintHorizontalOpt.setSelected(true);
hintHorizontalOpt.addActionListener(this);
@ -283,6 +323,9 @@ public class HintingDemo extends JFrame {
void sync()
{
antiAlias = antiAliasOpt.isSelected();
showGrid = showGridOpt.isSelected();
showOriginal = showOriginalOpt.isSelected();
showHinted = showHintedOpt.isSelected();
if (hintHorizontalOpt.isSelected())
flags &= ~FontDelegate.FLAG_NO_HINT_HORIZONTAL;
else

View File

@ -107,6 +107,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@ -145,8 +147,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
@ -170,6 +170,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -242,8 +251,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@

View File

@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
@ -161,6 +161,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@

View File

@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
@ -161,6 +161,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@

View File

@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
@ -161,6 +161,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@

View File

@ -98,6 +98,8 @@ CREATE_DSSI_LIBRARIES_FALSE = @CREATE_DSSI_LIBRARIES_FALSE@
CREATE_DSSI_LIBRARIES_TRUE = @CREATE_DSSI_LIBRARIES_TRUE@
CREATE_GCONF_PEER_LIBRARIES_FALSE = @CREATE_GCONF_PEER_LIBRARIES_FALSE@
CREATE_GCONF_PEER_LIBRARIES_TRUE = @CREATE_GCONF_PEER_LIBRARIES_TRUE@
CREATE_GSTREAMER_PEER_LIBRARIES_FALSE = @CREATE_GSTREAMER_PEER_LIBRARIES_FALSE@
CREATE_GSTREAMER_PEER_LIBRARIES_TRUE = @CREATE_GSTREAMER_PEER_LIBRARIES_TRUE@
CREATE_GTK_PEER_LIBRARIES_FALSE = @CREATE_GTK_PEER_LIBRARIES_FALSE@
CREATE_GTK_PEER_LIBRARIES_TRUE = @CREATE_GTK_PEER_LIBRARIES_TRUE@
CREATE_JNI_HEADERS_FALSE = @CREATE_JNI_HEADERS_FALSE@
@ -136,8 +138,6 @@ EXEEXT = @EXEEXT@
FASTJAR = @FASTJAR@
FGREP = @FGREP@
FIND = @FIND@
FOUND_CACAO_FALSE = @FOUND_CACAO_FALSE@
FOUND_CACAO_TRUE = @FOUND_CACAO_TRUE@
FOUND_ECJ_FALSE = @FOUND_ECJ_FALSE@
FOUND_ECJ_TRUE = @FOUND_ECJ_TRUE@
FOUND_GCJ_FALSE = @FOUND_GCJ_FALSE@
@ -161,6 +161,15 @@ GJDOC = @GJDOC@
GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@
GREP = @GREP@
GSTREAMER_BASE_CFLAGS = @GSTREAMER_BASE_CFLAGS@
GSTREAMER_BASE_LIBS = @GSTREAMER_BASE_LIBS@
GSTREAMER_CFLAGS = @GSTREAMER_CFLAGS@
GSTREAMER_FILE_READER = @GSTREAMER_FILE_READER@
GSTREAMER_LIBS = @GSTREAMER_LIBS@
GSTREAMER_MIXER_PROVIDER = @GSTREAMER_MIXER_PROVIDER@
GSTREAMER_PLUGINS_BASE_CFLAGS = @GSTREAMER_PLUGINS_BASE_CFLAGS@
GSTREAMER_PLUGINS_BASE_LIBS = @GSTREAMER_PLUGINS_BASE_LIBS@
GST_PLUGIN_LDFLAGS = @GST_PLUGIN_LDFLAGS@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_LIBS = @GTK_LIBS@
INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@
@ -233,8 +242,6 @@ USER_CLASSLIB = @USER_CLASSLIB@
USER_JAVAH = @USER_JAVAH@
USER_SPECIFIED_CLASSLIB_FALSE = @USER_SPECIFIED_CLASSLIB_FALSE@
USER_SPECIFIED_CLASSLIB_TRUE = @USER_SPECIFIED_CLASSLIB_TRUE@
USER_SPECIFIED_JAVAH_FALSE = @USER_SPECIFIED_JAVAH_FALSE@
USER_SPECIFIED_JAVAH_TRUE = @USER_SPECIFIED_JAVAH_TRUE@
USE_ESCHER_FALSE = @USE_ESCHER_FALSE@
USE_ESCHER_TRUE = @USE_ESCHER_TRUE@
USE_PREBUILT_GLIBJ_ZIP_FALSE = @USE_PREBUILT_GLIBJ_ZIP_FALSE@

View File

@ -1,6 +1,6 @@
/* ArrayReferenceCommandSet.java -- class to implement the Array
Reference Command Set
Copyright (C) 2005, 2007 Free Software Foundation
Copyright (C) 2005 Free Software Foundation
This file is part of GNU Classpath.

View File

@ -115,8 +115,16 @@ public interface FontDelegate
* Returns the number of glyphs in this font face.
*/
public int getNumGlyphs();
/**
* Returns the glyph code for the specified character.
*
* @param c the character to map
*
* @return the glyph code
*/
public int getGlyphIndex(int c);
/**
* Returns the index of the glyph which gets displayed if the font
* cannot map a Unicode code point to a glyph. Many fonts show this

View File

@ -617,7 +617,17 @@ public final class OpenTypeFont
return new GNUGlyphVector(this, font, frc, glyphs);
}
/**
* Returns the glyph code for the specified character.
*
* @param c the character to map
*
* @return the glyph code
*/
public int getGlyphIndex(int c)
{
return getCharGlyphMap().getGlyph(c);
}
/**
* Determines the advance width for a glyph.

View File

@ -51,6 +51,7 @@ import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Paint;
import java.awt.PaintContext;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.RenderingHints;
@ -75,10 +76,10 @@ import java.awt.image.DataBuffer;
import java.awt.image.ImageObserver;
import java.awt.image.Raster;
import java.awt.image.RenderedImage;
import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@ -147,7 +148,7 @@ import java.util.Map;
*/
public abstract class AbstractGraphics2D
extends Graphics2D
implements Cloneable
implements Cloneable, Pixelizer
{
/**
@ -155,13 +156,6 @@ public abstract class AbstractGraphics2D
*/
private static final Font FONT = new Font("SansSerif", Font.PLAIN, 12);
/**
* Accuracy of the sampling in the anti-aliasing shape filler.
* Lower values give more speed, while higher values give more quality.
* It is advisable to choose powers of two.
*/
private static final int AA_SAMPLING = 8;
/**
* Caches certain shapes to avoid massive creation of such Shapes in
* the various draw* and fill* methods.
@ -226,17 +220,6 @@ public abstract class AbstractGraphics2D
*/
private WritableRaster destinationRaster;
/**
* Stores the alpha values for a scanline in the anti-aliasing shape
* renderer.
*/
private transient int[] alpha;
/**
* The edge table for the scanline conversion algorithms.
*/
private transient ArrayList[] edgeTable;
/**
* Indicates if certain graphics primitives can be rendered in an optimized
* fashion. This will be the case if the following conditions are met:
@ -931,8 +914,8 @@ public abstract class AbstractGraphics2D
{
// Initialize clip if not already present.
if (clip == null)
clip = s;
setClip(s);
// This is so common, let's optimize this.
else if (clip instanceof Rectangle && s instanceof Rectangle)
{
@ -1174,7 +1157,9 @@ public abstract class AbstractGraphics2D
{
if (isOptimized)
{
rawDrawLine(x1, y1, x2, y2);
int tx = (int) transform.getTranslateX();
int ty = (int) transform.getTranslateY();
rawDrawLine(x1 + tx, y1 + ty, x2 + tx, y2 + ty);
}
else
{
@ -1214,7 +1199,8 @@ public abstract class AbstractGraphics2D
{
if (isOptimized)
{
rawFillRect(x, y, width, height);
rawFillRect(x + (int) transform.getTranslateX(),
y + (int) transform.getTranslateY(), width, height);
}
else
{
@ -1352,8 +1338,16 @@ public abstract class AbstractGraphics2D
public void drawPolyline(int[] xPoints, int[] yPoints, int npoints)
{
// FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented");
ShapeCache sc = getShapeCache();
if (sc.polyline == null)
sc.polyline = new GeneralPath();
GeneralPath p = sc.polyline;
p.reset();
if (npoints > 0)
p.moveTo(xPoints[0], yPoints[0]);
for (int i = 1; i < npoints; i++)
p.lineTo(xPoints[i], yPoints[i]);
fill(p);
}
/**
@ -1364,6 +1358,7 @@ public abstract class AbstractGraphics2D
ShapeCache sc = getShapeCache();
if (sc.polygon == null)
sc.polygon = new Polygon();
sc.polygon.reset();
sc.polygon.xpoints = xPoints;
sc.polygon.ypoints = yPoints;
sc.polygon.npoints = npoints;
@ -1378,6 +1373,7 @@ public abstract class AbstractGraphics2D
ShapeCache sc = getShapeCache();
if (sc.polygon == null)
sc.polygon = new Polygon();
sc.polygon.reset();
sc.polygon.xpoints = xPoints;
sc.polygon.ypoints = yPoints;
sc.polygon.npoints = npoints;
@ -1397,7 +1393,10 @@ public abstract class AbstractGraphics2D
{
boolean ret;
if (isOptimized)
ret = rawDrawImage(image, x, y, observer);
{
ret = rawDrawImage(image, x + (int) transform.getTranslateX(),
y + (int) transform.getTranslateY(), observer);
}
else
{
AffineTransform t = new AffineTransform();
@ -1559,17 +1558,15 @@ public abstract class AbstractGraphics2D
if (isFont)
{
Object v = renderingHints.get(RenderingHints.KEY_TEXT_ANTIALIASING);
// We default to antialiasing on for text as long as we have no
// good hinting implemented.
antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
//|| v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
// We default to antialiasing for text rendering.
antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON
|| v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
}
else
{
Object v = renderingHints.get(RenderingHints.KEY_ANTIALIASING);
antialias = (v == RenderingHints.VALUE_ANTIALIAS_ON);
}
ScanlineConverter sc = getScanlineConverter();
int resolution = 0;
if (antialias)
@ -1577,7 +1574,7 @@ public abstract class AbstractGraphics2D
// Adjust resolution according to rendering hints.
resolution = 2;
}
sc.renderShape(this, s, clip, transform, resolution);
sc.renderShape(this, s, clip, transform, resolution, renderingHints);
}
/**
@ -1609,12 +1606,20 @@ public abstract class AbstractGraphics2D
*/
protected void rawDrawLine(int x0, int y0, int x1, int y1)
{
draw(new Line2D.Float(x0, y0, x1, y1));
ShapeCache sc = getShapeCache();
if (sc.line == null)
sc.line = new Line2D.Float();
sc.line.setLine(x0, y0, x1, y1);
draw(sc.line);
}
protected void rawDrawRect(int x, int y, int w, int h)
{
draw(new Rectangle(x, y, w, h));
ShapeCache sc = getShapeCache();
if (sc.rect == null)
sc.rect = new Rectangle();
sc.rect.setBounds(x, y, w, h);
draw(sc.rect);
}
/**
@ -1662,7 +1667,11 @@ public abstract class AbstractGraphics2D
*/
protected void rawFillRect(int x, int y, int w, int h)
{
fill(new Rectangle(x, y, w, h));
ShapeCache sc = getShapeCache();
if (sc.rect == null)
sc.rect = new Rectangle();
sc.rect.setBounds(x, y, w, h);
fill(sc.rect);
}
/**
@ -1718,10 +1727,38 @@ public abstract class AbstractGraphics2D
* @param x1 the right offset
* @param y the scanline
*/
protected void fillScanline(int x0, int x1, int y)
public void renderScanline(int y, ScanlineCoverage c)
{
PaintContext pCtx = paintContext;
int x0 = c.getMinX();
int x1 = c.getMaxX();
Raster paintRaster = pCtx.getRaster(x0, y, x1 - x0, 1);
// Do the anti aliasing thing.
float coverageAlpha = 0;
float maxCoverage = c.getMaxCoverage();
ColorModel cm = pCtx.getColorModel();
DataBuffer db = paintRaster.getDataBuffer();
Point loc = new Point(paintRaster.getMinX(), paintRaster.getMinY());
SampleModel sm = paintRaster.getSampleModel();
WritableRaster writeRaster = Raster.createWritableRaster(sm, db, loc);
WritableRaster alphaRaster = cm.getAlphaRaster(writeRaster);
int pixel;
ScanlineCoverage.Iterator iter = c.iterate();
while (iter.hasNext())
{
ScanlineCoverage.Range range = iter.next();
coverageAlpha = range.getCoverage() / maxCoverage;
if (coverageAlpha < 1.0)
{
for (int x = range.getXPos(); x < range.getXPosEnd(); x++)
{
pixel = alphaRaster.getSample(x, y, 0);
pixel = (int) (pixel * coverageAlpha);
alphaRaster.setSample(x, y, 0, pixel);
}
}
}
ColorModel paintColorModel = pCtx.getColorModel();
CompositeContext cCtx = composite.createContext(paintColorModel,
getColorModel(),
@ -1733,66 +1770,6 @@ public abstract class AbstractGraphics2D
}
/**
* Fills a horizontal line between x0 and x1 for anti aliased rendering.
* the alpha array contains the deltas of the alpha values from one pixel
* to the next.
*
* @param alpha the alpha values in the scanline
* @param x0 the beginning of the scanline
* @param yy the y coordinate of the line
*/
private void fillScanlineAA(int[] alpha, int x0, int yy, int numPixels,
PaintContext pCtx, int offs)
{
CompositeContext cCtx = composite.createContext(pCtx.getColorModel(),
getColorModel(),
renderingHints);
Raster paintRaster = pCtx.getRaster(x0, yy, numPixels, 1);
//System.err.println("paintColorModel: " + pCtx.getColorModel());
WritableRaster aaRaster = paintRaster.createCompatibleWritableRaster();
ColorModel cm = pCtx.getColorModel();
double lastAlpha = 0.;
int lastAlphaInt = 0;
Object pixel = null;
int[] comps = null;
int x1 = x0 + numPixels;
for (int x = x0; x < x1; x++)
{
int i = x - offs;
if (alpha[i] != 0)
{
lastAlphaInt += alpha[i];
lastAlpha = (double) lastAlphaInt / (double) AA_SAMPLING;
alpha[i] = 0;
}
pixel = paintRaster.getDataElements(x - x0, 0, pixel);
comps = cm.getComponents(pixel, comps, 0);
if (cm.hasAlpha() && ! cm.isAlphaPremultiplied())
comps[comps.length - 1] *= lastAlpha;
else
{
int max;
if (cm.hasAlpha())
max = comps.length - 2;
else
max = comps.length - 1;
for (int j = 0; j < max; j++)
comps[j] *= lastAlpha;
}
pixel = cm.getDataElements(comps, 0, pixel);
aaRaster.setDataElements(x - x0, 0, pixel);
}
WritableRaster targetChild =
destinationRaster.createWritableTranslatedChild(-x0, -yy);
cCtx.compose(aaRaster, targetChild, targetChild);
updateRaster(destinationRaster, x0, yy, numPixels, 1);
cCtx.dispose();
}
/**
* Initializes this graphics object. This must be called by subclasses in
* order to correctly initialize the state of this object.
@ -1971,4 +1948,5 @@ public abstract class AbstractGraphics2D
}
return sc;
}
}

View File

@ -0,0 +1,56 @@
/* Pixelizer.java -- Interface for the target of the rasterizer
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.java2d;
/**
* A pixelizer is responsible for actually manipulating the pixel of a drawing
* surface after the scanline conversion process. It receives coverage
* information for a scanline and adjusts the surface pixels accordingly.
*/
public interface Pixelizer
{
/**
* Renders the pixel for one scanline at the Y location <code>y</code>
* and using the coverage information in <code>sc</code>.
*
* @param y the scanline Y coordinate
* @param sc the coverage information
*/
void renderScanline(int y, ScanlineCoverage sc);
}

View File

@ -1,5 +1,5 @@
/* ScanlineConverter.java -- Rasterizes Shapes
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -40,6 +40,7 @@ package gnu.java.awt.java2d;
import gnu.java.math.Fixed;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.PathIterator;
@ -47,7 +48,7 @@ import java.awt.geom.PathIterator;
/**
* Rasterizes {@link Shape} objects on an AbstractGraphics2D.
*/
final class ScanlineConverter
public final class ScanlineConverter
{
/**
@ -56,10 +57,15 @@ final class ScanlineConverter
private static int FIXED_DIGITS = 6;
/**
* The fixed value for the number 1.
* The fixed point constant for the number one.
*/
private static int ONE = Fixed.fixedValue(FIXED_DIGITS, 1);
/**
* The number of significant bits for the Y resolution.
*/
private static int Y_RESOLUTION = 4;
/**
* The actual number of scanlines.
*/
@ -109,6 +115,13 @@ final class ScanlineConverter
private int minY;
private int maxY;
private int minX;
private int maxX;
/**
* Holds and manages information about the pixel coverage.
*/
private ScanlineCoverage scanlineCoverage;
/**
* Create a new ScanlineConverter.
@ -120,18 +133,23 @@ final class ScanlineConverter
activeEdges = new ActiveEdges();
edgePool = new PolyEdge();
edgePoolLast = edgePool;
scanlineCoverage = new ScanlineCoverage();
}
/**
* Renders the specified shape using the specified clip and transform.
*
* @param p the pixelizer that receives the coverage information
* @param shape the shape to render
* @param clip the clip
* @param trans the transform
*/
void renderShape(AbstractGraphics2D g, Shape shape, Shape clip,
AffineTransform trans, int res)
public void renderShape(Pixelizer p, Shape shape, Shape clip,
AffineTransform trans, int res, RenderingHints hints)
{
// TODO: Do something useful with the rendering hints. Like, adjusting
// the resolution.
// Prepare resolution and upper bounds.
clear();
setResolution(res);
@ -139,11 +157,12 @@ final class ScanlineConverter
boolean haveClip = clip != null;
// Add shapes.
PathIterator path = shape.getPathIterator(trans, resolution);
float flatness = Fixed.floatValue(FIXED_DIGITS, resolution / 2);
PathIterator path = shape.getPathIterator(trans, flatness);
addShape(path, false);
if (haveClip)
{
path= clip.getPathIterator(trans, resolution);
path= clip.getPathIterator(trans, flatness);
addShape(path, true);
}
@ -157,11 +176,11 @@ final class ScanlineConverter
}
int y = upperBounds;
int lastIndex = scanlineIndex(y - resolution);
int index;
activeEdges.clear();
// The render loop...
Scanline scanline = null;
int lastRealY = Fixed.intValue(FIXED_DIGITS, y);
while (y <= maxY)
{
// First we put together our list of active edges.
@ -184,15 +203,16 @@ final class ScanlineConverter
activeEdges.intersectSortAndPack(FIXED_DIGITS, y + halfStep);
// Ok, now we can perform the actual scanlining.
boolean push = lastIndex != index;
doScanline(g, y, push, haveClip);
int realY = Fixed.intValue(FIXED_DIGITS, y + resolution);
boolean push = lastRealY != realY;
doScanline(p, y, push, haveClip);
// Remove obsolete active edges.
//activeEdges.remove(y + halfStep);
// Go on with the next line...
y += resolution;
lastIndex = index;
lastRealY = realY;
}
}
@ -212,17 +232,31 @@ final class ScanlineConverter
sl.clear();
}
// Reset scanline coverage.
scanlineCoverage.clear();
// Reset bounds.
minY = Integer.MAX_VALUE;
maxY = Integer.MIN_VALUE;
minX = Integer.MAX_VALUE;
maxX = Integer.MIN_VALUE;
}
/**
* Performs the scanlining on the current set of active edges.
*
* @param p the pixelizer to receive the pixel coverage data
* @param y the Y coordinate
* @param push true when the scanline is ready to be pushed to the
* pixelizer
* @param haveClip true when there's a clip, false otherwise
*/
private void doScanline(AbstractGraphics2D g, int y, boolean push,
private void doScanline(Pixelizer p, int y, boolean push,
boolean haveClip)
{
// First, rewind the scanline coverage.
scanlineCoverage.rewind();
// We begin outside the clip and outside the shape. We only draw when
// we are inside the clip AND inside the shape.
boolean inClip = ! haveClip;
@ -238,22 +272,16 @@ final class ScanlineConverter
int x0 = lastEdge.xIntersection;
int x1 = edge.xIntersection;
assert x0 <= x1;
if (push)
{
if (resolution == ONE)
{
// Non-AA rendering.
g.fillScanline(Fixed.intValue(FIXED_DIGITS, x0),
Fixed.intValue(FIXED_DIGITS, x1 - resolution),
Fixed.intValue(FIXED_DIGITS, y));
}
else
{
// AA rendering.
// FIXME: Implement.
System.err.println("Implement AA rendering.");
}
}
int pix0 = Fixed.intValue(FIXED_DIGITS, x0);
int pix1 = Fixed.intValue(FIXED_DIGITS, x1);
int frac0 = ONE - Fixed.trunc(FIXED_DIGITS, x0);
int frac1 = ONE - Fixed.trunc(FIXED_DIGITS, x1);
// Only keep the first 4 digits after the point.
frac0 = frac0 >> (FIXED_DIGITS - Y_RESOLUTION);
frac1 = frac1 >> (FIXED_DIGITS - Y_RESOLUTION);
scanlineCoverage.add(pix0, 1 * (1 << Y_RESOLUTION), frac0);
scanlineCoverage.add(pix1, -1 * (1 << Y_RESOLUTION), -frac1);
}
if (edge.isClip)
inClip = ! inClip;
@ -262,7 +290,15 @@ final class ScanlineConverter
lastEdge = edge;
}
}
// Push out the whole scanline to the pixelizer.
if (push && ! scanlineCoverage.isEmpty())
{
p.renderScanline(Fixed.intValue(FIXED_DIGITS, y), scanlineCoverage);
scanlineCoverage.clear();
}
}
/**
* Sets the resolution. A value of 0 rasterizes the shape normally without
@ -272,9 +308,12 @@ final class ScanlineConverter
*/
private void setResolution(int res)
{
int scanlinesPerPixel = 1 << res;
int one = Fixed.fixedValue(FIXED_DIGITS, 1);
resolution = one / (1 << res);
resolution = one / (scanlinesPerPixel);
halfStep = resolution / 2;
scanlineCoverage.setMaxCoverage(scanlinesPerPixel << Y_RESOLUTION);
}
/**
@ -309,6 +348,8 @@ final class ScanlineConverter
startY = lastY = Fixed.fixedValue(FIXED_DIGITS, coords[1]);
minY = Math.min(startY, minY);
maxY = Math.max(startY, maxY);
minX = Math.min(startX, minX);
maxX = Math.max(startX, maxX);
break;
case PathIterator.SEG_LINETO:
int x = Fixed.fixedValue(FIXED_DIGITS, coords[0]);
@ -318,6 +359,8 @@ final class ScanlineConverter
lastY = y;
minY = Math.min(lastY, minY);
maxY = Math.max(lastY, maxY);
minX = Math.min(lastX, minX);
maxX = Math.max(lastX, maxX);
break;
case PathIterator.SEG_CLOSE:
edgePoolAdd(lastX, lastY, startX, startY, clip);
@ -371,7 +414,7 @@ final class ScanlineConverter
{
int val1 = Fixed.div(FIXED_DIGITS, y, resolution);
int rounded = Fixed.round(FIXED_DIGITS, val1);
return Fixed.div(FIXED_DIGITS, rounded, resolution);
return Fixed.mul(FIXED_DIGITS, rounded, resolution);
}
/**

View File

@ -0,0 +1,630 @@
/* ScanlineCoverage.java -- Manages coverage information for a scanline
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.java2d;
/**
* Stores and handles the pixel converage for a scanline. The pixel coverage
* is stored as sorted list of {@linke Covergage} entries, each of which holds
* information about the coverage for the X and Y axis. This is utilized to
* compute the actual coverage for each pixel on the scanline and finding
* chunks of pixels with equal coverage quickly.
*/
public final class ScanlineCoverage
{
/**
* Iterates over the coverage list and calculates the actual coverage
* ranges on a scanline.
*/
public final class Iterator
{
/**
* This instance is reused in the iteration.
*/
private Range range;
/**
* The pointer to the current item in the iteration.
*/
private Coverage currentItem;
/**
* The current coverage value.
*/
private int currentCoverage;
/**
* True when the current pixel coverage has already been handled, false
* otherwise.
*/
private boolean handledPixelCoverage;
/**
* Creates a new CoverageIterator.
*/
Iterator()
{
range = new Range();
}
/**
* Returns the next coverage range on the scanline. The returned object
* will always be the same object, but with different values. Keep that
* in mind when dealing with this object.
*
* @return the next coverage range on the scanline
*/
public Range next()
{
// TODO: Lump together the single-pixel coverage and the
// between-pixel coverage when the pixel coverage delta is 0.
if (handledPixelCoverage == false)
{
// Handle single pixel coverage.
range.setXPos(currentItem.xPos);
range.setLength(1);
range.setCoverage(currentCoverage + currentItem.pixelCoverage);
handledPixelCoverage = true;
}
else
{
// Handle pixel span coverage.
currentCoverage += currentItem.covDelta;
range.setCoverage(currentCoverage);
range.setXPos(currentItem.xPos + 1);
currentItem = currentItem.next;
range.setLength(currentItem.xPos - range.xPos);
handledPixelCoverage = false;
}
return range;
}
/**
* Returns {@ true} when there are more coverage ranges to iterate,
* {@ false} otherwise.
*
* @return {@ true} when there are more coverage ranges to iterate,
* {@ false} otherwise
*/
public boolean hasNext()
{
boolean hasNext;
if (currentItem != null && handledPixelCoverage == false)
{
// We have at least one more coverage item when there's a pixel
// coverage piece left.
hasNext = true;
}
else if (currentItem == null || currentItem.next == null
|| currentItem.next == last)
{
hasNext = false;
}
else
{
hasNext = true;
}
return hasNext;
}
/**
* Resets this iterator to the start of the list.
*/
void reset()
{
currentItem = head;
currentCoverage = 0;
handledPixelCoverage = false;
}
}
/**
* A data object that carries information about pixel coverage on a scanline.
* The data consists of a starting X position on the scanline, the
* length of the range in pixels and the actual coverage value.
´ */
public static final class Range
{
/**
* The X position on the scanline, in pixels.
*/
private int xPos;
/**
* The length of the range, in pixels.
*/
private int length;
/**
* The actual coverage. The relation depends on
* {@link ScanlineCoverage#maxCoverage}.
*/
private int coverage;
/**
* Creates a new CoverageRange object.
*/
Range()
{
// Nothing to do. The values get initialized in the corresponding
// setters.
}
/**
* Sets the X start position (left) on the scanline. This value is
* considered to be in pixels and device space.
*
* @param x the x position
*/
void setXPos(int x)
{
xPos = x;
}
/**
* Returns the X start position (left) on the scanline. This value
* is considered to be in pixels and device space.
*
* @return the X position on the scanline
*/
public int getXPos()
{
return xPos;
}
/**
* Sets the length of the pixel range. This is in pixel units.
*
* @param l the length of the range
*/
void setLength(int l)
{
length = l;
}
/**
* Returns the length of the range in pixel units.
*
* @return the length of the range in pixel units
*/
public int getLength()
{
return length;
}
/**
* Returns the first X position after the range.
*
* @return the first X position after the range
*/
public int getXPosEnd()
{
return xPos + length;
}
/**
* Sets the coverage of the pixel range. The relation of that value
* depends on {@link ScanlineCoverage#maxCoverage}.
*
* @param cov the coverage value for the pixel range
*/
void setCoverage(int cov)
{
coverage = cov;
}
/**
* Returns the coverage of the pixel range. The relation of this value
* depends on {@link ScanlineCoverage#getMaxCoverage()}.
*
* @return the coverage of the pixel range
*/
public int getCoverage()
{
return coverage;
}
/**
* Returns a string representation.
*/
public String toString()
{
return "Coverage range: xPos=" + xPos + ", length=" + length
+ ", coverage: " + coverage;
}
}
/**
* One bucket in the list.
*/
private static final class Coverage
{
/**
* The X coordinate on the scanline to which this bucket belongs.
*/
int xPos;
/**
* The coverage delta from the pixel at xPos to xPos + 1.
*/
int covDelta;
/**
* The delta for the pixel at xPos. This is added to the pixel at xPos,
* but not to the following pixel.
*/
int pixelCoverage;
/**
* Implements a linked list. This points to the next element of the list.
*/
Coverage next;
/**
* Returns the X coordinate for this entry.
*
* @return the X coordinate for this entry
*/
public int getXPos()
{
return xPos;
}
/**
* Returns the coverage delta for this entry.
*
* @return the coverage delta for this entry
*/
public int getCoverageDelta()
{
return covDelta;
}
/**
* Returns a string representation.
*
* @return a string representation
*/
public String toString()
{
return "Coverage: xPos: " + xPos + ", covDelta: " + covDelta;
}
/**
* Returns a string representation of this entry and all the following
* in the linked list.
*
* @return a string representation of this entry and all the following
* in the linked list
*/
public String list()
{
String str = toString();
if (next != null)
str = str + " --> " + next.list();
return str;
}
}
/**
* The head of the sorted list of buckets.
*/
private Coverage head;
/**
* The current bucket. We make use of the fact that the scanline converter
* always scans the scanline (and thus this list) from left to right to
* quickly find buckets or insertion points.
*/
private Coverage current;
/**
* The item that is before current in the list.
*/
private Coverage currentPrev;
/**
* The bucket after the last valid bucket. Unused buckets are not thrown
* away and garbage collected. Instead, we keep them at the tail of the list
* and reuse them when necessary.
*/
private Coverage last;
/**
* The last valid entry.
*/
private Coverage lastPrev;
/**
* The minimum X coordinate of this scanline.
*/
private int minX;
/**
* The maximum X coordinate of this scanline.
*/
private int maxX;
/**
* The maximum coverage value.
*/
private int maxCoverage;
/**
* The iterator over the ranges of this scanline.
*/
private Iterator iterator;
/**
* Creates a new ScanlineCoverage instance.
*/
public ScanlineCoverage()
{
iterator = new Iterator();
}
/**
* Indicates the the next scan of the scanline begins and that the next
* request will be at the beginning of this list. This makes searching and
* sorting of this list very quick.
*/
public void rewind()
{
current = head;
currentPrev = null;
}
/**
* Clears the list. This does not throw away the old buckets but only
* resets the end-pointer of the list to the first element. All buckets are
* then unused and are reused when the list is filled again.
*/
public void clear()
{
last = head;
lastPrev = null;
current = head;
currentPrev = null;
minX = Integer.MAX_VALUE;
maxX = Integer.MIN_VALUE;
}
/**
* This adds the specified coverage to the pixel at the specified
* X position.
*
* @param x the X position
* @param xc the x coverage
* @param yc the y coverage
*/
public void add(int x, int xc, int yc)
{
Coverage bucket = findOrInsert(x);
bucket.covDelta += xc;
bucket.pixelCoverage += yc;
minX = Math.min(minX, x);
maxX = Math.max(maxX, x);
}
/**
* Returns the maximum coverage value for the scanline.
*
* @return the maximum coverage value for the scanline
*/
public int getMaxCoverage()
{
return maxCoverage;
}
/**
* Sets the maximum coverage value for the scanline.
*
* @param maxCov the maximum coverage value for the scanline
*/
void setMaxCoverage(int maxCov)
{
maxCoverage = maxCov;
}
/**
* Returns the maximum X coordinate of the current scanline.
*
* @return the maximum X coordinate of the current scanline
*/
public int getMaxX()
{
return maxX;
}
/**
* Returns the minimum X coordinate of the current scanline.
*
* @return the minimum X coordinate of the current scanline
*/
public int getMinX()
{
return minX;
}
/**
* Finds the bucket in the list with the specified X coordinate.
* If no such bucket is found, then a new one is fetched (either a cached
* bucket from the end of the list or a newly allocated one) inserted at the
* correct position and returned.
*
* @param x the X coordinate
*
* @return a bucket to hold the coverage data
*/
private Coverage findOrInsert(int x)
{
// First search for a matching bucket.
if (head == null)
{
// Special case: the list is still empty.
// Testpoint 1.
head = new Coverage();
head.xPos = x;
current = head;
currentPrev = null;
return head;
}
// This performs a linear search, starting from the current bucket.
// This is reasonably efficient because access to this list is always done
// in a linear fashion and we are usually not more then 1 or 2 buckets away
// from the one we're looking for.
Coverage match = current;
Coverage prev = currentPrev;
while (match != last && match.xPos < x)
{
prev = match;
match = match.next;
}
// At this point we have either found an entry with xPos >= x, or reached
// the end of the list (match == last || match == null).
if (match == null)
{
// End of the list. No cached items to reuse.
// Testpoint 2.
match = new Coverage();
match.xPos = x;
if (prev != null)
prev.next = match;
current = match;
currentPrev = prev;
return match;
}
else if (match == last)
{
// End of the list. Reuse this item. Expand list.
// Testpoint 3.
last = match.next;
lastPrev = match;
match.xPos = x;
match.covDelta = 0;
match.pixelCoverage = 0;
// Keep link to last element or null, indicating the end of the list.
current = match;
currentPrev = prev;
return match;
}
if (x == match.xPos)
{
// Special case: We have another coverage entry at the same location
// as an already existing entry. Return this.
// Testpoint 4.
current = match;
currentPrev = prev;
return match;
}
else // x <= match.xPos
{
assert (x <= match.xPos);
assert (prev == null ||x > prev.xPos);
// Create new entry, or reuse existing one.
Coverage cov;
if (last != null)
{
// Testpoint 5.
cov = last;
last = cov.next;
lastPrev.next = last;
}
else
{
// Testpoint 6.
cov = new Coverage();
}
cov.xPos = x;
cov.covDelta = 0;
cov.pixelCoverage = 0;
// Insert this item in the list.
if (prev != null)
{
// Testpoint 5 & 6.
prev.next = cov;
cov.next = match;
current = cov;
currentPrev = prev;
}
else
{
// Testpoint 7.
assert (match == head);
// Insert at head.
head = cov;
head.next = match;
current = head;
currentPrev = null;
}
return cov;
}
}
/**
* (Re-)Starts iterating the coverage values for the scanline.
* Use the returned iterator to get the consecutive coverage ranges.
*
* @return the iterator
*/
public Iterator iterate()
{
iterator.reset();
return iterator;
}
/**
* Returns {@ true} if this object has no entries for the current scanline,
* {@ false} otherwise.
*
* @return {@ true} if this object has no entries for the current scanline,
* {@ false} otherwise
*/
public boolean isEmpty()
{
return head == null || head == last
|| head.next == null || head.next == last;
}
}

View File

@ -42,6 +42,7 @@ import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.geom.Arc2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.RoundRectangle2D;
@ -82,4 +83,8 @@ public class ShapeCache
*/
public Polygon polygon;
/**
* A cached polyline.
*/
public GeneralPath polyline;
}

View File

@ -644,7 +644,7 @@ public abstract class ClasspathFontPeer
* be ignored.
*/
public abstract boolean canDisplay (Font font, char c);
public abstract boolean canDisplay (Font font, int c);
/**
* Implementation of {@link Font#canDisplay(String)},

View File

@ -449,4 +449,13 @@ public class GLightweightPeer
{
// Nothing to do here for lightweights.
}
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed,
long time, sun.awt.CausedFocusEvent.Cause cause)
{
// Always grant focus request.
return true;
}
}

View File

@ -1726,7 +1726,8 @@ public abstract class CairoGraphics2D extends Graphics2D
.equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF));
ignoreAA = true;
if (gv instanceof FreetypeGlyphVector && alpha == 1.0)
if (gv instanceof FreetypeGlyphVector && alpha == 1.0
&& !((FreetypeGlyphVector)gv).hasTransforms())
{
int n = gv.getNumGlyphs ();
int[] codes = gv.getGlyphCodes (0, n, null);
@ -2164,4 +2165,4 @@ public abstract class CairoGraphics2D extends Graphics2D
return new Rectangle2D.Double(minX, minY, (maxX - minX), (maxY - minY));
}
}
}

View File

@ -938,4 +938,4 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
}
}

View File

@ -43,6 +43,8 @@ import java.awt.font.FontRenderContext;
import java.awt.font.GlyphJustificationInfo;
import java.awt.font.GlyphMetrics;
import java.awt.font.GlyphVector;
import java.awt.font.TextAttribute;
import java.awt.font.TransformAttribute;
import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath;
import java.awt.geom.Point2D;
@ -86,7 +88,10 @@ public class FreetypeGlyphVector extends GlyphVector
private long[] fontSet = null;
/**
* Glyph transforms. (de facto only the translation is used)
* Glyph transforms. Supports all transform operations.
*
* The identity transform should not be stored in this array; use a null
* instead (will result in performance improvements).
*/
private AffineTransform[] glyphTransforms;
@ -185,9 +190,12 @@ public class FreetypeGlyphVector extends GlyphVector
fontSet = new long[nGlyphs];
glyphPositions = new float[(nGlyphs + 1) * 2];
glyphTransforms = new AffineTransform[ nGlyphs ];
Arrays.fill(glyphTransforms, null);
for(int i = 0; i < nGlyphs; i++ )
{
glyphTransforms[ i ] = new AffineTransform( gv.glyphTransforms[ i ] );
if (gv.glyphTransforms[i] != null)
glyphTransforms[ i ] = new AffineTransform(gv.glyphTransforms[i]);
glyphCodes[i] = gv.glyphCodes[ i ];
}
System.arraycopy(gv.glyphPositions, 0, glyphPositions, 0,
@ -313,6 +321,25 @@ public class FreetypeGlyphVector extends GlyphVector
}
glyphPositions[nGlyphs * 2] = x;
glyphPositions[nGlyphs * 2 + 1] = y;
// Apply any transform that may be in the font's attributes
TransformAttribute ta;
ta = (TransformAttribute)font.getAttributes().get(TextAttribute.TRANSFORM);
if (ta != null)
{
AffineTransform tx = ta.getTransform();
// Transform glyph positions
tx.transform(glyphPositions, 0, glyphPositions, 0,
glyphPositions.length / 2);
// Also store per-glyph scale/shear/rotate (but not translation)
double[] matrix = new double[4];
tx.getMatrix(matrix);
AffineTransform deltaTx = new AffineTransform(matrix);
if (!deltaTx.isIdentity())
Arrays.fill(glyphTransforms, deltaTx);
}
}
/**
@ -375,7 +402,7 @@ public class FreetypeGlyphVector extends GlyphVector
p.getY() + r.getY() + r.getHeight()};
if (glyphTransforms[glyphIndex] != null)
glyphTransforms[glyphIndex].transform(bounds, 0, bounds, 0, 4);
glyphTransforms[glyphIndex].transform(bounds, 0, bounds, 0, 2);
return new Rectangle2D.Double(bounds[0], bounds[1], bounds[2] - bounds[0],
bounds[3] - bounds[1]);
@ -473,7 +500,19 @@ public class FreetypeGlyphVector extends GlyphVector
{
return glyphTransforms[glyphIndex];
}
/**
* Checks whether any transform has been set on any glyphs.
*/
protected boolean hasTransforms()
{
for (int i = 0; i < glyphTransforms.length; i++)
if (glyphTransforms[i] != null)
return true;
return false;
}
/**
* Returns the visual bounds of a glyph
* May be off by a pixel or two due to hinting/rasterization.
@ -570,6 +609,19 @@ public class FreetypeGlyphVector extends GlyphVector
*/
public void setGlyphTransform(int glyphIndex, AffineTransform newTX)
{
// The identity transform should never be in the glyphTransforms array;
// using and checking for nulls can be much faster.
if (newTX != null && newTX.isIdentity())
newTX = null;
// If the old and new transforms are identical, bail
if (glyphTransforms[glyphIndex] == null && newTX == null)
return;
if (newTX != null && newTX.equals(glyphTransforms[glyphIndex]))
return;
// Invalidate bounds cache and set new transform
logicalBounds = null;
glyphTransforms[glyphIndex] = newTX;
}

View File

@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
import gnu.classpath.Pointer;
import gnu.java.awt.ClasspathToolkit;
import gnu.java.awt.peer.ClasspathFontPeer;
import gnu.java.awt.font.opentype.NameDecoder;
@ -172,6 +174,14 @@ public class GdkFontPeer extends ClasspathFontPeer
private ByteBuffer nameTable = null;
/**
* The pointer to the native font data.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer nativeFont;
private native void initState ();
private native void dispose ();
private native void setFont (String family, int style, int size);
@ -351,7 +361,7 @@ public class GdkFontPeer extends ClasspathFontPeer
return NameDecoder.getName(nameTable, name, locale);
}
public boolean canDisplay (Font font, char c)
public boolean canDisplay (Font font, int c)
{
// FIXME: inquire with pango
return true;

View File

@ -52,6 +52,8 @@ import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
import java.util.Locale;
import gnu.classpath.Pointer;
public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
{
private final int native_state = GtkGenericPeer.getUniqueInteger ();
@ -59,15 +61,24 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
private GdkScreenGraphicsDevice defaultDevice;
private GdkScreenGraphicsDevice[] devices;
/**
* The pointer to the native display resource.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer display;
static
{
System.loadLibrary("gtkpeer");
initStaticState ();
GtkToolkit.initializeGlobalIDs();
initIDs();
}
static native void initStaticState();
private static native void initIDs();
public GdkGraphicsEnvironment ()
{

View File

@ -68,6 +68,8 @@ import javax.imageio.spi.ImageWriterSpi;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
import gnu.classpath.Pointer;
public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
{
static
@ -94,6 +96,14 @@ public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
// the current set of ImageConsumers for this decoder
Vector curr;
/**
* The pointer to the native pixbuf loader.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer nativeDecoder;
// interface to GdkPixbuf
// These native functions should be called with the pixbufLock held.
native void initState ();

View File

@ -91,4 +91,9 @@ public class GdkRobotPeer implements RobotPeer
return pixels;
}
public void dispose()
{
// Nothing to do here yet.
}
}

View File

@ -46,6 +46,8 @@ import java.awt.Rectangle;
import java.awt.Window;
import java.util.ArrayList;
import gnu.classpath.Pointer;
class GdkScreenGraphicsDevice extends GraphicsDevice
{
private final int native_state = GtkGenericPeer.getUniqueInteger ();
@ -85,15 +87,23 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
* method must be called.
*/
DisplayMode fixedDisplayMode;
/**
* The pointer to the native screen resource.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer screen;
static
{
System.loadLibrary("gtkpeer");
initStaticState ();
GtkToolkit.initializeGlobalIDs();
initIDs();
}
static native void initStaticState();
static native void initIDs();
GdkScreenGraphicsDevice (GdkGraphicsEnvironment e)
{

View File

@ -616,11 +616,18 @@ public class GtkComponentPeer extends GtkGenericPeer
setVisible (true);
}
protected void postMouseEvent(int id, long when, int mods, int x, int y,
protected void postMouseEvent(int id, long when, int mods, int x, int y,
int clickCount, boolean popupTrigger)
{
q().postEvent(new MouseEvent(awtComponent, id, when, mods, x, y,
clickCount, popupTrigger));
// It is important to do the getLocationOnScreen() here, instead
// of using the old MouseEvent constructors, because
// Component.getLocationOnScreen() locks on the AWT lock, which can
// trigger a deadlock. You don't want this.
Point locOnScreen = getLocationOnScreen();
q().postEvent(new MouseEvent(awtComponent, id, when, mods, x, y,
locOnScreen.x + x, locOnScreen.y + y,
clickCount, popupTrigger,
MouseEvent.NOBUTTON));
}
/**
@ -899,4 +906,14 @@ public class GtkComponentPeer extends GtkGenericPeer
// FIXME: implement
}
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed,
long time, sun.awt.CausedFocusEvent.Cause cause)
{
// TODO: Implement this properly and remove the other requestFocus()
// methods.
return true;
}
}

View File

@ -244,6 +244,13 @@ public class GtkFramePeer extends GtkWindowPeer
// TODO Auto-generated method stub
return false;
}
public Rectangle getBoundsPrivate()
{
// TODO: Implement this properly.
throw new InternalError("Not yet implemented");
}
}

View File

@ -43,6 +43,8 @@ import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import gnu.classpath.Pointer;
public class GtkGenericPeer
{
// Used by Native State Association (NSA) functions to map
@ -55,6 +57,40 @@ public class GtkGenericPeer
// The widget or other java-side object we wrap.
protected final Object awtWidget;
/**
* The pointer to the native GTK widget.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer widget;
/**
* The pointer to the global reference to this object. The native
* code creates a JNI global reference of the peer object to be able
* to pass it to the event callbacks. It gets stored here, so that
* we can later delete it in the dispose() method.
*
* This field is manipulated by native code. Don't change or remove
* without adjusting the native code.
*/
private Pointer globalRef;
/**
* We initialize the field IDs that are used by native code here because
* these remain valid until a class gets unloaded.
*/
static
{
GtkToolkit.initializeGlobalIDs();
initIDs();
}
/**
* Initializes the field IDs that are used by the native code.
*/
private static native void initIDs();
/**
* Dispose of our native state. Calls gtk_widget_destroy on the
* native widget and removes the awtWidget from the native state

View File

@ -144,10 +144,39 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
static native void gtkQuit();
/**
* Initializes field IDs that are used by native code.
*/
private static native void initIDs();
/**
* True when the field IDs are already initialized, false otherwise.
*/
private static boolean initializedGlobalIDs = false;
/**
* Initializes some global fieldIDs for use in the native code. This is
* called by a couple of classes in the GTK peers to ensure that
* some necessary stuff is loaded.
*/
static synchronized void initializeGlobalIDs()
{
if (! initializedGlobalIDs)
{
initIDs();
initializedGlobalIDs = true;
}
}
static
{
System.loadLibrary("gtkpeer");
/**
* Gotta do that first.
*/
initializeGlobalIDs();
int portableNativeSync;
String portNatSyncProp =
System.getProperty("gnu.classpath.awt.gtk.portable.native.sync");
@ -716,4 +745,17 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
public native int getMouseNumberOfButtons();
@Override
public boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType)
{
return false;
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
{
return false;
}
} // class GtkToolkit

View File

@ -398,4 +398,29 @@ public class GtkWindowPeer extends GtkContainerPeer
{
return new Rectangle(x, y, width, height);
}
public void updateIconImages()
{
// TODO: Implement properly.
}
public void updateMinimumSize()
{
// TODO: Implement properly.
}
public void setModalBlocked(java.awt.Dialog d, boolean b)
{
// TODO: Implement properly.
}
public void updateFocusableWindowState()
{
// TODO: Implement properly.
}
public void setAlwaysOnTop(boolean b)
{
// TODO: Implement properly.
}
}

View File

@ -86,7 +86,17 @@ public class VolatileImageGraphics extends ComponentGraphics
public GraphicsConfiguration getDeviceConfiguration()
{
return owner.component.getGraphicsConfiguration();
GraphicsConfiguration conf;
if (owner.component != null)
{
conf = owner.component.getGraphicsConfiguration();
}
else
{
return java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice().getDefaultConfiguration();
}
return conf;
}
public Graphics create()

View File

@ -368,4 +368,18 @@ public class HeadlessToolkit
return graphicsEnv;
}
@Override
public boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType)
{
return false;
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
{
return false;
}
}

View File

@ -821,4 +821,14 @@ public class QtComponentPeer extends NativeWrapper implements ComponentPeer
{
// TODO Auto-generated method stub
}
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed,
long time, sun.awt.CausedFocusEvent.Cause cause)
{
// TODO: Implement this properly and remove the other requestFocus()
// methods.
return true;
}
}

View File

@ -94,7 +94,7 @@ public class QtFontMetrics extends FontMetrics
// ****************** Package private ***************************
native boolean canDisplay( char c );
native boolean canDisplay( int c );
// ****************** Public methods ****************************

View File

@ -98,7 +98,7 @@ public class QtFontPeer extends ClasspathFontPeer
// ****************** ClasspathFontPeer Methods.
public boolean canDisplay (Font font, char c)
public boolean canDisplay (Font font, int c)
{
return metrics.canDisplay( c );
}

View File

@ -155,4 +155,10 @@ public class QtFramePeer extends QtWindowPeer implements FramePeer
return false;
}
public Rectangle getBoundsPrivate()
{
// TODO: Implement this properly.
throw new InternalError("Not yet implemented");
}
}

View File

@ -452,4 +452,19 @@ public class QtToolkit extends ClasspathToolkit
// return new QtEmbeddedWindowPeer( this, w );
return null;
}
@Override
public boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType)
{
return false;
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
{
return false;
}
}

View File

@ -77,4 +77,29 @@ public class QtWindowPeer extends QtContainerPeer implements WindowPeer
return false;
}
public void updateIconImages()
{
// TODO: Implement properly.
}
public void updateMinimumSize()
{
// TODO: Implement properly.
}
public void setModalBlocked(java.awt.Dialog d, boolean b)
{
// TODO: Implement properly.
}
public void updateFocusableWindowState()
{
// TODO: Implement properly.
}
public void setAlwaysOnTop(boolean b)
{
// TODO: Implement properly.
}
}

View File

@ -1,5 +1,5 @@
/* SwingButtonPeer.java -- A Swing based peer for AWT buttons
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -44,6 +44,7 @@ import java.awt.Image;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.peer.ButtonPeer;
@ -70,12 +71,12 @@ public class SwingButtonPeer
extends JButton
implements SwingComponent
{
Button button;
Button button;
SwingButton(Button button)
{
this.button = button;
}
SwingButton(Button button)
{
this.button = button;
}
/**
* Overridden so that this method returns the correct value even without a
@ -184,6 +185,26 @@ public class SwingButtonPeer
par = button.getParent();
return par;
}
/**
* Handles focus events by forwarding it to
* <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
processFocusEvent(ev);
}
public void requestFocus() {
SwingButtonPeer.this.requestFocus(awtComponent, false, true, 0);
}
public boolean requestFocus(boolean temporary) {
return SwingButtonPeer.this.requestFocus(awtComponent, temporary,
true, 0);
}
}
/**

View File

@ -0,0 +1,261 @@
/* SwingCheckboxPeer.java -- A Swing based peer for AWT checkboxes
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.peer.swing;
import java.awt.Button;
import java.awt.Checkbox;
import java.awt.CheckboxGroup;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Label;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.peer.CheckboxPeer;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JToggleButton;
/**
* A CheckboxPeer implementation that is backed by the Swing JCheckBox.
*/
public class SwingCheckboxPeer extends SwingComponentPeer implements
CheckboxPeer {
/**
* A spezialized Swing checkbox used to paint the checkbox for the
* AWT checkbox.
*/
private class SwingCheckbox
extends JCheckBox
implements SwingComponent
{
Checkbox checkbox;
SwingCheckbox(Checkbox checkbox)
{
this.checkbox = checkbox;
}
/**
* Returns this checkbox.
*
* @return <code>this</code>
*/
public JComponent getJComponent()
{
return this;
}
/**
* Handles mouse events by forwarding it to
* <code>processMouseEvent()</code>.
*
* @param ev the mouse event
*/
public void handleMouseEvent(MouseEvent ev)
{
ev.setSource(this);
processMouseEvent(ev);
}
/**
* Handles mouse motion events by forwarding it to
* <code>processMouseMotionEvent()</code>.
*
* @param ev the mouse motion event
*/
public void handleMouseMotionEvent(MouseEvent ev)
{
ev.setSource(this);
processMouseMotionEvent(ev);
}
/**
* Handles key events by forwarding it to <code>processKeyEvent()</code>.
*
* @param ev the mouse event
*/
public void handleKeyEvent(KeyEvent ev)
{
ev.setSource(this);
processKeyEvent(ev);
}
/**
* Handles focus events by forwarding it to
* <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
processFocusEvent(ev);
}
/**
* Overridden so that this method returns the correct value even without a
* peer.
*
* @return the screen location of the button
*/
public Point getLocationOnScreen()
{
return SwingCheckboxPeer.this.getLocationOnScreen();
}
/**
* Overridden so that the isShowing method returns the correct value
* for the swing button, even if it has no peer on its own.
*
* @return <code>true</code> if the button is currently showing,
* <code>false</code> otherwise
*/
public boolean isShowing()
{
boolean retVal = false;
if (checkbox != null)
retVal = checkbox.isShowing();
return retVal;
}
/**
* Overridden, so that the Swing button can create an Image without its
* own peer.
*
* @param w the width of the image
* @param h the height of the image
*
* @return an image
*/
public Image createImage(int w, int h)
{
return SwingCheckboxPeer.this.createImage(w, h);
}
public Graphics getGraphics()
{
return SwingCheckboxPeer.this.getGraphics();
}
public Container getParent()
{
Container par = null;
if (checkbox != null)
par = checkbox.getParent();
return par;
}
public void requestFocus() {
SwingCheckboxPeer.this.requestFocus(awtComponent, false, true, 0);
}
public boolean requestFocus(boolean temporary) {
return SwingCheckboxPeer.this.requestFocus(awtComponent, temporary,
true, 0);
}
}
/**
* Listens for ActionEvents on the Swing button and triggers corresponding
* ActionEvents on the AWT button.
*/
class SwingCheckboxListener implements ItemListener
{
Checkbox awtCheckbox;
SwingCheckboxListener(Checkbox checkbox)
{
awtCheckbox = checkbox;
}
/**
* Receives notification when an action was performend on the button.
*
* @param event the action event
*/
public void itemStateChanged(ItemEvent event)
{
awtCheckbox.setState(event.getStateChange()==ItemEvent.SELECTED);
ItemListener[] l = awtCheckbox.getItemListeners();
if (l.length == 0)
return;
ItemEvent ev = new ItemEvent(awtCheckbox, ItemEvent.ITEM_STATE_CHANGED,
awtCheckbox, event.getStateChange());
for (int i = 0; i < l.length; ++i)
l[i].itemStateChanged(ev);
}
}
/**
* Creates a new SwingCheckboxPeer instance.
*/
public SwingCheckboxPeer(Checkbox checkbox)
{
SwingCheckbox swingCheckbox = new SwingCheckbox(checkbox);
swingCheckbox.addItemListener(new SwingCheckboxListener(checkbox));
init(checkbox, swingCheckbox);
setLabel(checkbox.getLabel());
setState(checkbox.getState());
}
public void setCheckboxGroup(CheckboxGroup group)
{
// TODO: Implement this.
}
public void setLabel(String label)
{
((JToggleButton) swingComponent).setText(label);
}
public void setState(boolean state)
{
((JToggleButton) swingComponent).setSelected(state);
}
}

View File

@ -37,6 +37,7 @@ exception statement from your version. */
package gnu.java.awt.peer.swing;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
@ -86,4 +87,13 @@ public interface SwingComponent
* @param ev the key event
*/
void handleKeyEvent(KeyEvent ev);
/**
* Handles a focus event. This is usually forwarded to
* {@link Component#processFocusEvent(FocusEvent)} of the swing
* component.
*
* @param ev the focus event
*/
void handleFocusEvent(FocusEvent ev);
}

View File

@ -1,5 +1,5 @@
/* SwingComponentPeer.java -- An abstract base class for Swing based peers
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -45,6 +45,7 @@ import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
@ -54,6 +55,7 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.BufferCapabilities.FlipContents;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.PaintEvent;
@ -349,12 +351,7 @@ public class SwingComponentPeer
*/
public Dimension getMinimumSize()
{
Dimension retVal;
if (swingComponent != null)
retVal = swingComponent.getJComponent().getMinimumSize();
else
retVal = new Dimension(0, 0);
return retVal;
return minimumSize();
}
/**
@ -367,12 +364,7 @@ public class SwingComponentPeer
*/
public Dimension getPreferredSize()
{
Dimension retVal;
if (swingComponent != null)
retVal = swingComponent.getJComponent().getPreferredSize();
else
retVal = new Dimension(0, 0);
return retVal;
return preferredSize();
}
/**
@ -395,30 +387,28 @@ public class SwingComponentPeer
public void handleEvent(AWTEvent e)
{
switch (e.getID())
{
{
case PaintEvent.UPDATE:
case PaintEvent.PAINT:
// Need to synchronize to avoid threading problems on the
// paint event list.
// We must synchronize on the tree lock first to avoid deadlock,
// because Container.paint() will grab it anyway.
synchronized (this)
if (awtComponent.isShowing())
{
assert paintArea != null;
if (awtComponent.isShowing())
Rectangle clip ;
synchronized (this)
{
Graphics g = awtComponent.getGraphics();
try
{
Rectangle clip = paintArea;
g.clipRect(clip.x, clip.y, clip.width, clip.height);
peerPaint(g, e.getID() == PaintEvent.UPDATE);
}
finally
{
g.dispose();
paintArea = null;
}
coalescePaintEvent((PaintEvent) e);
assert paintArea != null;
clip = paintArea;
paintArea = null;
}
Graphics g = awtComponent.getGraphics();
try
{
g.clipRect(clip.x, clip.y, clip.width, clip.height);
peerPaint(g, e.getID() == PaintEvent.UPDATE);
}
finally
{
g.dispose();
}
}
break;
@ -438,10 +428,14 @@ public class SwingComponentPeer
case KeyEvent.KEY_TYPED:
handleKeyEvent((KeyEvent) e);
break;
case FocusEvent.FOCUS_GAINED:
case FocusEvent.FOCUS_LOST:
handleFocusEvent((FocusEvent)e);
break;
default:
// Other event types are not handled here.
break;
}
}
}
/**
@ -574,13 +568,16 @@ public class SwingComponentPeer
* This is implemented to call repaint() on the Swing component.
*
* @param tm number of milliseconds to wait with repainting
* @param x the X coordinate of the upper left corner of the damaged rectangle
* @param y the Y coordinate of the upper left corner of the damaged rectangle
* @param x the X coordinate of the upper left corner of the damaged
* rectangle
* @param y the Y coordinate of the upper left corner of the damaged
* rectangle
* @param width the width of the damaged rectangle
* @param height the height of the damaged rectangle
*/
public void repaint(long tm, int x, int y, int width, int height)
{
// NOTE: This is never called by AWT but is mandated by the peer interface.
if (swingComponent != null)
swingComponent.getJComponent().repaint(tm, x, y, width, height);
else
@ -602,8 +599,10 @@ public class SwingComponentPeer
*/
public void requestFocus()
{
if (swingComponent != null)
swingComponent.getJComponent().requestFocus();
// NOTE: This is never called by AWT but is mandated by the peer interface.
Toolkit tk = Toolkit.getDefaultToolkit();
EventQueue q = tk.getSystemEventQueue();
q.postEvent(new FocusEvent(awtComponent, FocusEvent.FOCUS_GAINED, false));
}
/**
@ -612,18 +611,22 @@ public class SwingComponentPeer
*
* This calls requestFocus() on the Swing component.
*
* @param source TODO
* @param bool1 TODO
* @param bool2 TODO
* @param x TODO
* @param source the actual component that requests focus (may be a
* lightweight descendant of the heavyweight container)
* @param tmp true when the change is temporary
* @param allowWindowFocus
* @param tm the timestamp of the focus change
*
* @return TODO
* @return true when the focus change is guaranteed to be granted, false
* otherwise
*/
public boolean requestFocus(Component source, boolean bool1, boolean bool2, long x)
public boolean requestFocus(Component source, boolean tmp,
boolean allowWindowFocus, long tm)
{
if (swingComponent != null)
swingComponent.getJComponent().requestFocus();
return swingComponent != null;
Toolkit tk = Toolkit.getDefaultToolkit();
EventQueue q = tk.getSystemEventQueue();
q.postEvent(new FocusEvent(source, FocusEvent.FOCUS_GAINED, tmp));
return true;
}
/**
@ -1100,6 +1103,19 @@ public class SwingComponentPeer
swingComponent.handleKeyEvent(e);
}
/**
* Handles focus events on the component. This is usually forwarded to the
* SwingComponent's processFocusEvent() method.
*
* @param e the key event
*/
protected void handleFocusEvent(FocusEvent e)
{
if (swingComponent != null)
swingComponent.handleFocusEvent(e);
}
/**
* Returns the AWT component for this peer.
*
@ -1109,4 +1125,12 @@ public class SwingComponentPeer
{
return awtComponent;
}
public boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed,
long time, sun.awt.CausedFocusEvent.Cause cause)
{
return true;
}
}

View File

@ -1,5 +1,5 @@
/* SwingContainerPeer.java -- A Swing based peer for AWT containers
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -92,7 +92,7 @@ public class SwingContainerPeer
* @see #peerPaintChildren(Graphics)
* @see #removeHeavyweightDescendent(Component)
*/
synchronized void addHeavyweightDescendent(Component comp)
protected synchronized void addHeavyweightDescendent(Component comp)
{
heavyweightDescendents.add(comp);
focusOwner = null;
@ -106,12 +106,24 @@ public class SwingContainerPeer
* @see #peerPaintChildren(Graphics)
* @see #addHeavyweightDescendent(Component)
*/
synchronized void removeHeavyweightDescendent(Component comp)
protected synchronized void removeHeavyweightDescendent(Component comp)
{
heavyweightDescendents.remove(comp);
focusOwner = null;
}
/**
* Returns an array of all registered heavyweight descendents.
*
* @return all registered heavyweight descendents
*/
protected Component[] getHeavyweightDescendents()
{
Component[] heavyweights = new Component[heavyweightDescendents.size()];
heavyweights = (Component[]) heavyweightDescendents.toArray(heavyweights);
return heavyweights;
}
/**
* Returns the insets of the container.
*
@ -339,7 +351,7 @@ public class SwingContainerPeer
{
Component owner = getFocusOwner();
if(owner != null)
owner.dispatchEvent(e);
owner.getPeer().handleEvent(e);
else
super.handleKeyEvent(e);
}

View File

@ -1,5 +1,5 @@
/* SwingLabelPeer.java -- A Swing based peer for AWT labels
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -42,6 +42,7 @@ import java.awt.Graphics;
import java.awt.Image;
import java.awt.Label;
import java.awt.Point;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.peer.LabelPeer;
@ -119,6 +120,17 @@ public class SwingLabelPeer
processKeyEvent(ev);
}
/**
* Handles focus events by forwarding it to
* <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
processFocusEvent(ev);
}
/**
* Overridden so that this method returns the correct value even without a
* peer.

View File

@ -1,5 +1,5 @@
/* SwingListPeer.java -- A Swing based peer for AWT lists
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -46,6 +46,7 @@ import java.awt.Image;
import java.awt.List;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.peer.ListPeer;
@ -128,6 +129,17 @@ public class SwingListPeer
processKeyEvent(ev);
}
/**
* Handles focus events by forwarding it to <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
processFocusEvent(ev);
}
/**
* Overridden so that this method returns the correct value even without a
* peer.

View File

@ -1,5 +1,5 @@
/* SwingPanelPeer.java -- A PanelPeer based on Swing
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -47,7 +47,7 @@ import java.awt.peer.PanelPeer;
* @author Roman Kennke (kennke@aicas.com)
*/
// TODO: Maybe base implementation on JPanel. However, this doesn't seem
// necessary, but might be good for more consistend Look.
// necessary, but might be good for more consistent Look.
public class SwingPanelPeer
extends SwingContainerPeer
implements PanelPeer

View File

@ -1,5 +1,5 @@
/* SwingTextAreaPeer.java -- A Swing based peer for AWT textareas
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -45,14 +45,20 @@ import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.TextArea;
import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
import java.awt.event.HierarchyEvent;
import java.awt.event.InputMethodEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.im.InputMethodRequests;
import java.awt.peer.TextAreaPeer;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JViewport;
import javax.swing.text.BadLocationException;
public class SwingTextAreaPeer
@ -65,15 +71,19 @@ public class SwingTextAreaPeer
*
* @author Roman Kennke (kennke@aicas.com)
*/
private class SwingTextArea
private class SwingScrollPane
extends JScrollPane
implements SwingComponent
{
SwingTextArea(Component comp)
SwingTextArea textArea;
SwingScrollPane(SwingTextArea textArea)
{
super(comp, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
super(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
this.textArea = textArea;
}
/**
@ -94,8 +104,17 @@ public class SwingTextAreaPeer
*/
public void handleMouseEvent(MouseEvent ev)
{
ev.setSource(this);
dispatchEvent(ev);
JViewport viewPort = getViewport();
if(viewPort.contains(ev.getPoint()))
{
ev.setSource(textArea);
textArea.dispatchEvent(ev);
}
else
{
ev.setSource(this);
this.dispatchEvent(ev);
}
}
/**
@ -114,7 +133,7 @@ public class SwingTextAreaPeer
*/
public void handleMouseMotionEvent(MouseEvent ev)
{
processMouseMotionEvent(ev);
textArea.processMouseMotionEvent(ev);
}
/**
@ -124,7 +143,18 @@ public class SwingTextAreaPeer
*/
public void handleKeyEvent(KeyEvent ev)
{
processKeyEvent(ev);
textArea.processKeyEvent(ev);
}
/**
* Handles focus events by forwarding it to
* <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
textArea.processFocusEvent(ev);
}
/**
@ -179,35 +209,160 @@ public class SwingTextAreaPeer
par = SwingTextAreaPeer.this.awtComponent.getParent();
return par;
}
public void requestFocus() {
SwingTextAreaPeer.this.requestFocus(awtComponent, false, true, 0);
}
public boolean requestFocus(boolean temporary) {
return SwingTextAreaPeer.this.requestFocus(awtComponent, temporary,
true, 0);
}
}
private class SwingTextArea extends JTextArea
{
/**
* Make this method accessible in this Package.
*/
protected final void processComponentKeyEvent(KeyEvent e)
{
super.processComponentKeyEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processMouseMotionEvent(MouseEvent ev)
{
super.processMouseMotionEvent(ev);
}
/**
* Make this method accessible in this Package.
*/
protected final void processComponentEvent(ComponentEvent e)
{
super.processComponentEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processFocusEvent(FocusEvent e)
{
super.processFocusEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processHierarchyBoundsEvent(HierarchyEvent e)
{
super.processHierarchyBoundsEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processHierarchyEvent(HierarchyEvent e)
{
super.processHierarchyEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processInputMethodEvent(InputMethodEvent e)
{
super.processInputMethodEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processMouseEvent(MouseEvent e)
{
super.processMouseEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processMouseWheelEvent(MouseWheelEvent e)
{
super.processMouseWheelEvent(e);
}
/**
* Make this method accessible in this Package.
*/
protected final void processKeyEvent(KeyEvent e)
{
super.processKeyEvent(e);
}
public void requestFocus() {
SwingTextAreaPeer.this.requestFocus(awtComponent, false, true, 0);
}
public boolean requestFocus(boolean temporary) {
return SwingTextAreaPeer.this.requestFocus(awtComponent, temporary,
true, 0);
}
}
/**
* The actual JTextArea.
*/
private JTextArea jTextArea;
private SwingTextArea jTextArea;
public SwingTextAreaPeer(TextArea textArea)
{
super();
System.err.println("new SwingTextAreaPeer");
jTextArea = new JTextArea();
SwingTextArea swingArea = new SwingTextArea(jTextArea);
jTextArea = new SwingTextArea();
SwingScrollPane swingArea = new SwingScrollPane(jTextArea);
init(textArea, swingArea);
JViewport viewport = new JViewport()
{
public Image createImage(int width, int height)
{
return awtComponent.createImage(width, height);
}
};
viewport.setView(jTextArea);
swingArea.setViewport(viewport);
// Pull over the text from the text area.
setText(textArea.getText());
// Pull over the number of rows and columns
// if non were set use default values
int columns = textArea.getColumns();
int rows = textArea.getRows();
if(columns == 0 && rows == 0)
{
columns = 25;
textArea.setColumns(columns);
rows = 5;
textArea.setRows(rows);
}
jTextArea.setColumns(columns);
jTextArea.setRows(rows);
}
public Dimension getMinimumSize(int rows, int cols)
{
// TODO Auto-generated method stub
return null;
return jTextArea.getMinimumSize();
}
public Dimension getPreferredSize(int rows, int cols)
{
// TODO Auto-generated method stub
return null;
return jTextArea.getPreferredSize();
}
public void insert(String text, int pos)
@ -220,16 +375,24 @@ public class SwingTextAreaPeer
jTextArea.insert(text, pos);
}
public Dimension minimumSize()
{
return jTextArea.getMinimumSize();
}
public Dimension preferredSize()
{
return jTextArea.getPreferredSize();
}
public Dimension minimumSize(int rows, int cols)
{
// TODO Auto-generated method stub
return null;
return jTextArea.getMinimumSize();
}
public Dimension preferredSize(int rows, int cols)
{
// TODO Auto-generated method stub
return null;
return jTextArea.getPreferredSize();
}
public void replaceRange(String text, int start, int end)
@ -310,8 +473,16 @@ public class SwingTextAreaPeer
public void setText(String text)
{
System.err.println("setText: " + text);
jTextArea.setText(text);
}
public void reshape(int x, int y, int width, int height)
{
if (swingComponent != null)
{
swingComponent.getJComponent().setBounds(x, y, width, height);
swingComponent.getJComponent().validate();
}
}
}

View File

@ -1,5 +1,5 @@
/* SwingTextFieldPeer.java -- A Swing based peer for AWT textfields
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -44,6 +44,7 @@ import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.TextField;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.im.InputMethodRequests;
@ -72,13 +73,13 @@ public class SwingTextFieldPeer
implements SwingComponent
{
TextField textField;
SwingTextField(TextField textField)
{
this.textField = textField;
}
TextField textField;
SwingTextField(TextField textField)
{
this.textField = textField;
}
/**
* Overridden to provide normal behaviour even without a real peer
* attached.
@ -91,8 +92,8 @@ public class SwingTextFieldPeer
}
/**
* Overridden so that the isShowing method returns the correct value for the
* swing button, even if it has no peer on its own.
* Overridden so that the isShowing method returns the correct value
* for the swing button, even if it has no peer on its own.
*
* @return <code>true</code> if the button is currently showing,
* <code>false</code> otherwise
@ -162,6 +163,18 @@ public class SwingTextFieldPeer
processKeyEvent(ev);
}
/**
* Handles focus events by forwarding it to
* <code>processFocusEvent()</code>.
*
* @param ev the Focus event
*/
public void handleFocusEvent(FocusEvent ev)
{
processFocusEvent(ev);
}
public Container getParent()
{
Container par = null;
@ -174,6 +187,16 @@ public class SwingTextFieldPeer
{
return SwingTextFieldPeer.this.getGraphics();
}
public void requestFocus() {
SwingTextFieldPeer.this.requestFocus(awtComponent, false, true, 0);
}
public boolean requestFocus(boolean temporary) {
return SwingTextFieldPeer.this.requestFocus(awtComponent, temporary,
true, 0);
}
}
/**

View File

@ -40,6 +40,7 @@ package gnu.java.awt.peer.swing;
import java.awt.Button;
import java.awt.Canvas;
import java.awt.Dialog;
import java.awt.Label;
import java.awt.Menu;
import java.awt.MenuBar;
@ -162,4 +163,19 @@ public abstract class SwingToolkit extends ClasspathToolkit
{
return new SwingTextFieldPeer(textField);
}
@Override
public boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType)
{
return false;
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
{
return false;
}
}

View File

@ -71,4 +71,29 @@ public abstract class SwingWindowPeer
super(window);
init(window, null);
}
public void updateIconImages()
{
// TODO: Implement properly.
}
public void updateMinimumSize()
{
// TODO: Implement properly.
}
public void setModalBlocked(java.awt.Dialog d, boolean b)
{
// TODO: Implement properly.
}
public void updateFocusableWindowState()
{
// TODO: Implement properly.
}
public void setAlwaysOnTop(boolean b)
{
// TODO: Implement properly.
}
}

View File

@ -405,8 +405,12 @@ final class KeyboardMapping
if ((xMods & Input.SHIFT_MASK) != 0)
mods |= KeyEvent.SHIFT_MASK | KeyEvent.SHIFT_DOWN_MASK;
if ((xMods & Input.META_MASK) != 0)
mods |= KeyEvent.META_MASK | KeyEvent.META_DOWN_MASK;
if ((xMods & Input.ALT_MASK) != 0)
mods |= KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK;
if ((xMods & Input.MOD5_MASK) != 0)
mods |= KeyEvent.ALT_GRAPH_MASK | KeyEvent.ALT_GRAPH_DOWN_MASK;
if ((xMods & Input.CONTROL_MASK) != 0)
mods |= KeyEvent.CTRL_MASK | KeyEvent.CTRL_DOWN_MASK;

View File

@ -0,0 +1,185 @@
/* PixmapVolatileImage.java -- VolatileImage implementation around a Pixmap
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.peer.x;
import gnu.x11.GC;
import gnu.x11.Pixmap;
import gnu.x11.image.Image;
import gnu.x11.image.ZPixmap;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import java.awt.ImageCapabilities;
import java.awt.Point;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.ComponentColorModel;
import java.awt.image.ComponentSampleModel;
import java.awt.image.DataBuffer;
import java.awt.image.ImageObserver;
import java.awt.image.Raster;
import java.awt.image.SampleModel;
import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
/**
* A {@link VolatileImage} implementation that wraps an X Pixmap.
*/
class PixmapVolatileImage
extends VolatileImage
{
/**
* The shared capabilities instance.
*/
private static final ImageCapabilities caps = new ImageCapabilities(true);
/**
* The underlying pixmap.
*/
private Pixmap pixmap;
/**
* Creates a new PixmapVolatileImage.
*
* @param w the width of the image
* @param h the height of the image
*/
public PixmapVolatileImage(int w, int h)
{
GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
XGraphicsDevice dev = (XGraphicsDevice) env.getDefaultScreenDevice();
pixmap = new Pixmap(dev.getDisplay(), w, h);
// Clear pixmap.
GC gc = new GC(pixmap);
gc.set_foreground(0xffffffff);
pixmap.fill_rectangle(gc, 0, 0, w, h);
}
@Override
public boolean contentsLost()
{
return false;
}
@Override
public Graphics2D createGraphics()
{
return new XGraphics2D(pixmap);
}
@Override
public ImageCapabilities getCapabilities()
{
return caps;
}
@Override
public int getHeight()
{
return pixmap.height;
}
@Override
public BufferedImage getSnapshot()
{
// TODO: Support non-24-bit resolutions.
int w = pixmap.width;
int h = pixmap.height;
ZPixmap zpixmap = (ZPixmap) pixmap.image(0, 0, w, h, 0xffffffff,
Image.Format.ZPIXMAP);
DataBuffer buffer = new ZPixmapDataBuffer(zpixmap);
SampleModel sm = new ComponentSampleModel(DataBuffer.TYPE_BYTE, w, h, 4,
w * 4,
new int[]{0, 1, 2, 3 });
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
ColorModel cm = new ComponentColorModel(cs, true, false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
WritableRaster raster = Raster.createWritableRaster(sm, buffer,
new Point(0, 0));
return new BufferedImage(cm, raster, false, null);
}
@Override
public int getWidth()
{
return pixmap.width;
}
@Override
public int validate(GraphicsConfiguration gc)
{
// TODO: Check compatibility with gc.
return IMAGE_OK;
}
@Override
public int getHeight(ImageObserver observer)
{
return getHeight();
}
@Override
public Object getProperty(String name, ImageObserver observer)
{
return null;
}
@Override
public int getWidth(ImageObserver observer)
{
return getWidth();
}
/**
* Returns the underlying X pixmap. This is used for the graphics code.
*
* @return the underlying X pixmap
*/
Pixmap getPixmap()
{
return pixmap;
}
}

View File

@ -97,8 +97,9 @@ public class XEventPump
display = d;
windows = new HashMap();
drag = -1;
Thread t = new Thread(this);
t.start();
Thread thread = new Thread(this, "X Event Pump");
thread.setDaemon(true);
thread.start();
}
/**
@ -148,8 +149,9 @@ public class XEventPump
private void handleEvent(Event xEvent)
{
Integer key = new Integer(xEvent.window_id());;
Window awtWindow = (Window) windows.get(key);
Integer key = null;
Window awtWindow = null;
if (XToolkit.DEBUG)
System.err.println("fetched event: " + xEvent);
@ -157,26 +159,45 @@ public class XEventPump
{
case ButtonPress.CODE:
ButtonPress bp = (ButtonPress) xEvent;
key= new Integer(bp.event_window_id);
awtWindow = (Window) windows.get(key);
// Create and post the mouse event.
int button = bp.detail();
// AWT cannot handle more than 3 buttons and expects 0 instead.
if (button >= gnu.x11.Input.BUTTON3)
button = 0;
drag = button;
MouseEvent mp = new MouseEvent(awtWindow, MouseEvent.MOUSE_PRESSED,
System.currentTimeMillis(), 0,
System.currentTimeMillis(),
KeyboardMapping.mapModifiers(bp.state()) | buttonToModifier(button),
bp.event_x(), bp.event_y(),
1, false, button);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mp);
break;
case ButtonRelease.CODE:
ButtonRelease br = (ButtonRelease) xEvent;
key= new Integer(br.event_window_id);
awtWindow = (Window) windows.get(key);
button = br.detail();
// AWT cannot handle more than 3 buttons and expects 0 instead.
if (button >= gnu.x11.Input.BUTTON3)
button = 0;
drag = -1;
MouseEvent mr = new MouseEvent(awtWindow, MouseEvent.MOUSE_RELEASED,
System.currentTimeMillis(), 0,
System.currentTimeMillis(),
KeyboardMapping.mapModifiers(br.state()) | buttonToModifier(button),
br.event_x(), br.event_y(),
1, false, br.detail());
1, false, button);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mr);
break;
case MotionNotify.CODE:
MotionNotify mn = (MotionNotify) xEvent;
key= new Integer(mn.event_window_id);
awtWindow = (Window) windows.get(key);
MouseEvent mm;
if (drag == -1)
{
@ -195,6 +216,8 @@ public class XEventPump
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(mm);
break;
case ConfigureNotify.CODE:
key= new Integer(((ConfigureNotify) xEvent).event_window_id);
awtWindow = (Window) windows.get(key);
ConfigureNotify c = (ConfigureNotify) xEvent;
if (XToolkit.DEBUG)
System.err.println("resize request for window id: " + key);
@ -213,6 +236,8 @@ public class XEventPump
}
break;
case Expose.CODE:
key= new Integer(((Expose) xEvent).window_id);
awtWindow = (Window) windows.get(key);
Expose exp = (Expose) xEvent;
if (XToolkit.DEBUG)
System.err.println("expose request for window id: " + key);
@ -228,6 +253,8 @@ public class XEventPump
break;
case KeyPress.CODE:
case KeyRelease.CODE:
key = new Integer(((Input) xEvent).event_window_id);
awtWindow = (Window) windows.get(key);
handleKeyEvent(xEvent, awtWindow);
break;
default:
@ -282,6 +309,23 @@ public class XEventPump
}
/** Translates an X button identifier to the AWT's MouseEvent modifier
* mask. As the AWT cannot handle more than 3 buttons those return
* <code>0</code>.
*/
static int buttonToModifier(int button)
{
switch (button)
{
case gnu.x11.Input.BUTTON1:
return MouseEvent.BUTTON1_DOWN_MASK | MouseEvent.BUTTON1_MASK;
case gnu.x11.Input.BUTTON2:
return MouseEvent.BUTTON2_DOWN_MASK | MouseEvent.BUTTON2_MASK;
case gnu.x11.Input.BUTTON3:
return MouseEvent.BUTTON3_DOWN_MASK | MouseEvent.BUTTON3_MASK;
}
return 0;
}
}

View File

@ -1,759 +0,0 @@
/* XFontPeer.java -- The font peer for X
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.peer.x;
import java.awt.AWTError;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.font.LineMetrics;
import java.awt.font.TextAttribute;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.InputStream;
import java.text.CharacterIterator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import gnu.java.awt.peer.ClasspathFontPeer;
import gnu.x11.Display;
import gnu.x11.Fontable;
/**
* The bridge from AWT to X fonts.
*
* @author Roman Kennke (kennke@aicas.com)
*/
public class XFontPeer
extends ClasspathFontPeer
{
/**
* The font mapping as specified in the file fonts.properties.
*/
private static Properties fontProperties;
static
{
fontProperties = new Properties();
InputStream in = XFontPeer.class.getResourceAsStream("fonts.properties");
try
{
fontProperties.load(in);
}
catch (IOException e)
{
e.printStackTrace();
}
}
/**
* The FontMetrics implementation for XFontPeer.
*/
private class XFontMetrics
extends FontMetrics
{
/**
* The ascent of the font.
*/
int ascent;
/**
* The descent of the font.
*/
int descent;
/**
* The maximum of the character advances.
*/
private int maxAdvance;
/**
* The internal leading.
*/
int leading;
/**
* Cached string metrics. This caches string metrics locally so that the
* server doesn't have to be asked each time.
*/
private HashMap metricsCache;
/**
* The widths of the characters indexed by the characters themselves.
*/
private int[] charWidths;
/**
* Creates a new XFontMetrics for the specified font.
*
* @param font the font
*/
protected XFontMetrics(Font font)
{
super(font);
metricsCache = new HashMap();
Fontable.FontReply info = getXFont().info();
ascent = info.font_ascent();
descent = info.font_descent();
maxAdvance = info.max_bounds().character_width();
leading = 0; // TODO: Not provided by X. Possible not needed.
if (info.min_byte1() == 0 && info.max_byte1() == 0)
readCharWidthsLinear(info);
else
readCharWidthsNonLinear(info);
}
/**
* Reads the character widths when specified in a linear fashion. That is
* when the min-byte1 and max-byte2 fields are both zero in the X protocol.
*
* @param info the font info reply
*/
private void readCharWidthsLinear(Fontable.FontReply info)
{
int startIndex = info.min_char_or_byte2();
int endIndex = info.max_char_or_byte2();
charWidths = new int[endIndex + 1];
// All the characters before startIndex are zero width.
for (int i = 0; i < startIndex; i++)
{
charWidths[i] = 0;
}
// All the other character info is fetched from the font info.
int index = startIndex;
Iterator charInfos = info.char_infos().iterator();
while (charInfos.hasNext())
{
Fontable.FontReply.CharInfo charInfo =
(Fontable.FontReply.CharInfo) charInfos.next();
charWidths[index] = charInfo.character_width();
index++;
}
}
private void readCharWidthsNonLinear(Fontable.FontReply info)
{
// TODO: Implement.
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Returns the ascent of the font.
*
* @return the ascent of the font
*/
public int getAscent()
{
return ascent;
}
/**
* Returns the descent of the font.
*
* @return the descent of the font
*/
public int getDescent()
{
return descent;
}
/**
* Returns the overall height of the font. This is the distance from
* baseline to baseline (usually ascent + descent + leading).
*
* @return the overall height of the font
*/
public int getHeight()
{
return ascent + descent;
}
/**
* Returns the leading of the font.
*
* @return the leading of the font
*/
public int getLeading()
{
return leading;
}
/**
* Returns the maximum advance for this font.
*
* @return the maximum advance for this font
*/
public int getMaxAdvance()
{
return maxAdvance;
}
/**
* Determines the width of the specified character <code>c</code>.
*
* @param c the character
*
* @return the width of the character
*/
public int charWidth(char c)
{
int width;
if (c > charWidths.length)
width = charWidths['?'];
else
width = charWidths[c];
return width;
}
/**
* Determines the overall width of the specified string.
*
* @param c the char buffer holding the string
* @param offset the starting offset of the string in the buffer
* @param length the number of characters in the string buffer
*
* @return the overall width of the specified string
*/
public int charsWidth(char[] c, int offset, int length)
{
int width = 0;
if (c.length > 0 && length > 0)
{
String s = new String(c, offset, length);
width = stringWidth(s);
}
return width;
}
/**
* Determines the overall width of the specified string.
*
* @param s the string
*
* @return the overall width of the specified string
*/
public int stringWidth(String s)
{
int width = 0;
if (s.length() > 0)
{
if (metricsCache.containsKey(s))
{
width = ((Integer) metricsCache.get(s)).intValue();
}
else
{
Fontable.TextExtentReply extents = getXFont().text_extent(s);
/*
System.err.println("string: '" + s + "' : ");
System.err.println("ascent: " + extents.getAscent());
System.err.println("descent: " + extents.getDescent());
System.err.println("overall ascent: " + extents.getOverallAscent());
System.err.println("overall descent: " + extents.getOverallDescent());
System.err.println("overall width: " + extents.getOverallWidth());
System.err.println("overall left: " + extents.getOverallLeft());
System.err.println("overall right: " + extents.getOverallRight());
*/
width = extents.overall_width(); // + extents.overall_left();
//System.err.println("String: " + s + ", width: " + width);
metricsCache.put(s, new Integer(width));
}
}
//System.err.print("stringWidth: '" + s + "': ");
//System.err.println(width);
return width;
}
}
/**
* The LineMetrics implementation for the XFontPeer.
*/
private class XLineMetrics
extends LineMetrics
{
/**
* Returns the ascent of the font.
*
* @return the ascent of the font
*/
public float getAscent()
{
return fontMetrics.ascent;
}
public int getBaselineIndex()
{
// FIXME: Implement this.
throw new UnsupportedOperationException();
}
public float[] getBaselineOffsets()
{
// FIXME: Implement this.
throw new UnsupportedOperationException();
}
/**
* Returns the descent of the font.
*
* @return the descent of the font
*/
public float getDescent()
{
return fontMetrics.descent;
}
/**
* Returns the overall height of the font. This is the distance from
* baseline to baseline (usually ascent + descent + leading).
*
* @return the overall height of the font
*/
public float getHeight()
{
return fontMetrics.ascent + fontMetrics.descent;
}
/**
* Returns the leading of the font.
*
* @return the leading of the font
*/
public float getLeading()
{
return fontMetrics.leading;
}
public int getNumChars()
{
// FIXME: Implement this.
throw new UnsupportedOperationException();
}
public float getStrikethroughOffset()
{
return 0.F; // TODO: Provided by X??
}
public float getStrikethroughThickness()
{
return 1.F; // TODO: Provided by X??
}
public float getUnderlineOffset()
{
return 0.F; // TODO: Provided by X??
}
public float getUnderlineThickness()
{
return 1.F; // TODO: Provided by X??
}
}
/**
* The X font.
*/
private gnu.x11.Font xfont;
private String name;
private int style;
private int size;
/**
* The font metrics for this font.
*/
XFontMetrics fontMetrics;
/**
* Creates a new XFontPeer for the specified font name, style and size.
*
* @param name the font name
* @param style the font style (bold / italic / normal)
* @param size the size of the font
*/
public XFontPeer(String name, int style, int size)
{
super(name, style, size);
this.name = name;
this.style = style;
this.size = size;
}
/**
* Creates a new XFontPeer for the specified font name and style
* attributes.
*
* @param name the font name
* @param atts the font attributes
*/
public XFontPeer(String name, Map atts)
{
super(name, atts);
String family = name;
if (family == null || family.equals(""))
family = (String) atts.get(TextAttribute.FAMILY);
if (family == null)
family = "SansSerif";
int size = 12;
Float sizeFl = (Float) atts.get(TextAttribute.SIZE);
if (sizeFl != null)
size = sizeFl.intValue();
int style = 0;
// Detect italic attribute.
Float posture = (Float) atts.get(TextAttribute.POSTURE);
if (posture != null && !posture.equals(TextAttribute.POSTURE_REGULAR))
style |= Font.ITALIC;
// Detect bold attribute.
Float weight = (Float) atts.get(TextAttribute.WEIGHT);
if (weight != null && weight.compareTo(TextAttribute.WEIGHT_REGULAR) > 0)
style |= Font.BOLD;
this.name = name;
this.style = style;
this.size = size;
}
/**
* Initializes the font peer with the specified attributes. This method is
* called from both constructors.
*
* @param name the font name
* @param style the font style
* @param size the font size
*/
private void init(String name, int style, int size)
{
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice dev = env.getDefaultScreenDevice();
if (dev instanceof XGraphicsDevice)
{
Display display = ((XGraphicsDevice) dev).getDisplay();
String fontDescr = encodeFont(name, style, size);
if (XToolkit.DEBUG)
System.err.println("XLFD font description: " + fontDescr);
xfont = new gnu.x11.Font(display, fontDescr);
}
else
{
throw new AWTError("Local GraphicsEnvironment is not XWindowGraphicsEnvironment");
}
}
public boolean canDisplay(Font font, char c)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public int canDisplayUpTo(Font font, CharacterIterator i, int start, int limit)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public String getSubFamilyName(Font font, Locale locale)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public String getPostScriptName(Font font)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public int getNumGlyphs(Font font)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public int getMissingGlyphCode(Font font)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public byte getBaselineFor(Font font, char c)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public String getGlyphName(Font font, int glyphIndex)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public GlyphVector createGlyphVector(Font font, FontRenderContext frc,
CharacterIterator ci)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public GlyphVector createGlyphVector(Font font, FontRenderContext ctx,
int[] glyphCodes)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public GlyphVector layoutGlyphVector(Font font, FontRenderContext frc,
char[] chars, int start, int limit,
int flags)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
/**
* Returns the font metrics for the specified font.
*
* @param font the font for which to fetch the font metrics
*
* @return the font metrics for the specified font
*/
public FontMetrics getFontMetrics(Font font)
{
if (font.getPeer() != this)
throw new AWTError("The specified font has a different peer than this");
if (fontMetrics == null)
fontMetrics = new XFontMetrics(font);
return fontMetrics;
}
/**
* Frees the font in the X server.
*/
protected void finalize()
{
if (xfont != null)
xfont.close();
}
public boolean hasUniformLineMetrics(Font font)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
/**
* Returns the line metrics for this font and the specified string and
* font render context.
*/
public LineMetrics getLineMetrics(Font font, CharacterIterator ci, int begin,
int limit, FontRenderContext rc)
{
return new XLineMetrics();
}
public Rectangle2D getMaxCharBounds(Font font, FontRenderContext rc)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
/**
* Encodes a font name + style + size specification into a X logical font
* description (XLFD) as described here:
*
* http://www.meretrx.com/e93/docs/xlfd.html
*
* This is implemented to look up the font description in the
* fonts.properties of this package.
*
* @param name the font name
* @param atts the text attributes
*
* @return the encoded font description
*/
static String encodeFont(String name, Map atts)
{
String family = name;
if (family == null || family.equals(""))
family = (String) atts.get(TextAttribute.FAMILY);
if (family == null)
family = "SansSerif";
int size = 12;
Float sizeFl = (Float) atts.get(TextAttribute.SIZE);
if (sizeFl != null)
size = sizeFl.intValue();
int style = 0;
// Detect italic attribute.
Float posture = (Float) atts.get(TextAttribute.POSTURE);
if (posture != null && !posture.equals(TextAttribute.POSTURE_REGULAR))
style |= Font.ITALIC;
// Detect bold attribute.
Float weight = (Float) atts.get(TextAttribute.WEIGHT);
if (weight != null && weight.compareTo(TextAttribute.WEIGHT_REGULAR) > 0)
style |= Font.BOLD;
return encodeFont(name, style, size);
}
/**
* Encodes a font name + style + size specification into a X logical font
* description (XLFD) as described here:
*
* http://www.meretrx.com/e93/docs/xlfd.html
*
* This is implemented to look up the font description in the
* fonts.properties of this package.
*
* @param name the font name
* @param style the font style
* @param size the font size
*
* @return the encoded font description
*/
static String encodeFont(String name, int style, int size)
{
StringBuilder key = new StringBuilder();
key.append(validName(name));
key.append('.');
switch (style)
{
case Font.BOLD:
key.append("bold");
break;
case Font.ITALIC:
key.append("italic");
break;
case (Font.BOLD | Font.ITALIC):
key.append("bolditalic");
break;
case Font.PLAIN:
default:
key.append("plain");
}
String protoType = fontProperties.getProperty(key.toString());
int s = validSize(size);
return protoType.replaceFirst("%d", String.valueOf(s * 10));
}
/**
* Checks the specified font name for a valid font name. If the font name
* is not known, then this returns 'sansserif' as fallback.
*
* @param name the font name to check
*
* @return a valid font name
*/
static String validName(String name)
{
String retVal;
if (name.equalsIgnoreCase("sansserif")
|| name.equalsIgnoreCase("serif")
|| name.equalsIgnoreCase("monospaced")
|| name.equalsIgnoreCase("dialog")
|| name.equalsIgnoreCase("dialoginput"))
{
retVal = name.toLowerCase();
}
else
{
retVal = "sansserif";
}
return retVal;
}
/**
* Translates an arbitrary point size to a size that is typically available
* on an X server. These are the sizes 8, 10, 12, 14, 18 and 24.
*
* @param size the queried size
* @return the real available size
*/
private static final int validSize(int size)
{
int val;
if (size <= 9)
val = 8;
else if (size <= 11)
val = 10;
else if (size <= 13)
val = 12;
else if (size <= 17)
val = 14;
else if (size <= 23)
val = 18;
else
val = 24;
return val;
}
/**
* Returns the X Font reference. This lazily loads the font when first
* requested.
*
* @return the X Font reference
*/
gnu.x11.Font getXFont()
{
if (xfont == null)
{
init(name, style, size);
}
return xfont;
}
}

View File

@ -42,17 +42,21 @@ import java.awt.FontMetrics;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.font.LineMetrics;
import java.awt.font.TextAttribute;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import gnu.java.awt.font.FontDelegate;
import gnu.java.awt.font.FontFactory;
@ -62,11 +66,30 @@ public class XFontPeer2
extends ClasspathFontPeer
{
/**
* The font mapping as specified in the file fonts.properties.
*/
private static Properties fontProperties;
static
{
fontProperties = new Properties();
InputStream in = XFontPeer2.class.getResourceAsStream("fonts.properties");
try
{
fontProperties.load(in);
}
catch (IOException e)
{
e.printStackTrace();
}
}
private class XLineMetrics
extends LineMetrics
{
private Font font;
private GlyphVector glyphVector;
// private CharacterIterator characterIterator;
// private int begin;
// private int limit;
@ -79,6 +102,8 @@ public class XFontPeer2
// begin = b;
// limit = l;
fontRenderContext = rc;
glyphVector = fontDelegate.createGlyphVector(font, fontRenderContext,
ci);
}
public float getAscent()
@ -86,7 +111,7 @@ public class XFontPeer2
return fontDelegate.getAscent(font.getSize(), fontRenderContext.getTransform(),
fontRenderContext.isAntiAliased(),
fontRenderContext.usesFractionalMetrics(), true);
}
}
public int getBaselineIndex()
{
@ -102,21 +127,18 @@ public class XFontPeer2
public float getDescent()
{
return (int) fontDelegate.getDescent(font.getSize(),
new AffineTransform(), false, false,
false);
return (int) fontDelegate.getDescent(font.getSize(), IDENDITY, false,
false, false);
}
public float getHeight()
{
// FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented");
return (float) glyphVector.getLogicalBounds().getHeight();
}
public float getLeading()
{
// FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented");
return getHeight() - getAscent() - getDescent();
}
public int getNumChars()
@ -150,6 +172,11 @@ public class XFontPeer2
private class XFontMetrics
extends FontMetrics
{
/**
* A cached point instance, to be used in #charWidth().
*/
private Point2D cachedPoint = new Point2D.Double();
XFontMetrics(Font f)
{
super(f);
@ -157,22 +184,20 @@ public class XFontPeer2
public int getAscent()
{
return (int) fontDelegate.getAscent(getFont().getSize(),
new AffineTransform(), false, false,
false);
return (int) fontDelegate.getAscent(getFont().getSize(), IDENDITY,
false, false, false);
}
public int getDescent()
{
return (int) fontDelegate.getDescent(getFont().getSize(),
new AffineTransform(), false, false,
false);
return (int) fontDelegate.getDescent(getFont().getSize(), IDENDITY,
false, false, false);
}
public int getHeight()
{
GlyphVector gv = fontDelegate.createGlyphVector(getFont(),
new FontRenderContext(new AffineTransform(), false, false),
new FontRenderContext(IDENDITY, false, false),
new StringCharacterIterator("m"));
Rectangle2D b = gv.getVisualBounds();
return (int) b.getHeight();
@ -180,8 +205,9 @@ public class XFontPeer2
public int charWidth(char c)
{
Point2D advance = new Point2D.Double();
fontDelegate.getAdvance(c, getFont().getSize(), new AffineTransform(),
int code = fontDelegate.getGlyphIndex(c);
Point2D advance = cachedPoint;
fontDelegate.getAdvance(code, font.getSize2D(), IDENDITY,
false, false, true, advance);
return (int) advance.getX();
}
@ -194,13 +220,18 @@ public class XFontPeer2
public int stringWidth(String s)
{
GlyphVector gv = fontDelegate.createGlyphVector(getFont(),
new FontRenderContext(new AffineTransform(), false, false),
new FontRenderContext(IDENDITY, false, false),
new StringCharacterIterator(s));
Rectangle2D b = gv.getVisualBounds();
return (int) b.getWidth();
}
}
/**
* The indendity transform, to be used in several methods.
*/
private static final AffineTransform IDENDITY = new AffineTransform();
private FontDelegate fontDelegate;
XFontPeer2(String name, int style, int size)
@ -208,7 +239,7 @@ public class XFontPeer2
super(name, style, size);
try
{
File fontfile = new File("/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf");
File fontfile = new File("/usr/share/fonts/truetype/freefont/FreeSans.ttf");
FileInputStream in = new FileInputStream(fontfile);
FileChannel ch = in.getChannel();
ByteBuffer buffer = ch.map(FileChannel.MapMode.READ_ONLY, 0,
@ -239,7 +270,7 @@ public class XFontPeer2
}
}
public boolean canDisplay(Font font, char c)
public boolean canDisplay(Font font, int c)
{
// FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented");
@ -326,4 +357,112 @@ public class XFontPeer2
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Encodes a font name + style + size specification into a X logical font
* description (XLFD) as described here:
*
* http://www.meretrx.com/e93/docs/xlfd.html
*
* This is implemented to look up the font description in the
* fonts.properties of this package.
*
* @param name the font name
* @param atts the text attributes
*
* @return the encoded font description
*/
static String encodeFont(String name, Map atts)
{
String family = name;
if (family == null || family.equals(""))
family = (String) atts.get(TextAttribute.FAMILY);
if (family == null)
family = "SansSerif";
int size = 12;
Float sizeFl = (Float) atts.get(TextAttribute.SIZE);
if (sizeFl != null)
size = sizeFl.intValue();
int style = 0;
// Detect italic attribute.
Float posture = (Float) atts.get(TextAttribute.POSTURE);
if (posture != null && !posture.equals(TextAttribute.POSTURE_REGULAR))
style |= Font.ITALIC;
// Detect bold attribute.
Float weight = (Float) atts.get(TextAttribute.WEIGHT);
if (weight != null && weight.compareTo(TextAttribute.WEIGHT_REGULAR) > 0)
style |= Font.BOLD;
return encodeFont(name, style, size);
}
/**
* Encodes a font name + style + size specification into a X logical font
* description (XLFD) as described here:
*
* http://www.meretrx.com/e93/docs/xlfd.html
*
* This is implemented to look up the font description in the
* fonts.properties of this package.
*
* @param name the font name
* @param style the font style
* @param size the font size
*
* @return the encoded font description
*/
static String encodeFont(String name, int style, int size)
{
StringBuilder key = new StringBuilder();
key.append(validName(name));
key.append('.');
switch (style)
{
case Font.BOLD:
key.append("bold");
break;
case Font.ITALIC:
key.append("italic");
break;
case (Font.BOLD | Font.ITALIC):
key.append("bolditalic");
break;
case Font.PLAIN:
default:
key.append("plain");
}
String protoType = fontProperties.getProperty(key.toString());
int s = size;
return protoType.replaceFirst("%d", String.valueOf(s * 10));
}
/**
* Checks the specified font name for a valid font name. If the font name
* is not known, then this returns 'sansserif' as fallback.
*
* @param name the font name to check
*
* @return a valid font name
*/
static String validName(String name)
{
String retVal;
if (name.equalsIgnoreCase("sansserif")
|| name.equalsIgnoreCase("serif")
|| name.equalsIgnoreCase("monospaced")
|| name.equalsIgnoreCase("dialog")
|| name.equalsIgnoreCase("dialoginput"))
{
retVal = name.toLowerCase();
}
else
{
retVal = "sansserif";
}
return retVal;
}
}

View File

@ -137,4 +137,10 @@ public class XFramePeer
throw new UnsupportedOperationException("Not yet implemented.");
}
public Rectangle getBoundsPrivate()
{
// TODO: Implement this properly.
throw new InternalError("Not yet implemented");
}
}

View File

@ -1,792 +0,0 @@
/* XGraphics.java -- The Graphics implementation for X
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.peer.x;
import gnu.x11.Colormap;
import gnu.x11.Data;
import gnu.x11.Display;
import gnu.x11.Drawable;
import gnu.x11.GC;
import gnu.x11.Pixmap;
import gnu.x11.Point;
import gnu.x11.image.ZPixmap;
import java.awt.AWTError;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Toolkit;
import java.awt.Transparency;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.text.AttributedCharacterIterator;
import java.util.HashMap;
public class XGraphics
extends Graphics
implements Cloneable
{
/**
* The X Drawable to draw on.
*/
private Drawable xdrawable;
/**
* The X graphics context (GC).
*/
private GC xgc;
/**
* The current translation.
*/
private int translateX;
private int translateY;
/**
* The current clip. Possibly null.
*/
private Rectangle clip;
/**
* The current font, possibly null.
*/
private Font font;
/**
* The current foreground color, possibly null.
*/
private Color foreground;
/**
* Indicates if this object has been disposed.
*/
private boolean disposed = false;
// TODO: Workaround for limitation in current Escher.
private Pixmap.Format pixmapFormat;
private int imageByteOrder;
private int pixelByteCount;
/**
* Creates a new XGraphics on the specified X Drawable.
*
* @param d the X Drawable for which we create the Graphics
*/
XGraphics(Drawable d)
{
xdrawable = d;
xgc = new GC(d);
translateX = 0;
translateY = 0;
clip = new Rectangle(0, 0, d.width, d.height);
Display display = xdrawable.display;
pixmapFormat = display.default_pixmap_format;
imageByteOrder = display.image_byte_order;
pixelByteCount = pixmapFormat.bits_per_pixel () / 8;
}
/**
* Creates an exact copy of this graphics context.
*
* @return an exact copy of this graphics context
*/
public Graphics create()
{
XGraphics copy = (XGraphics) clone();
return copy;
}
/**
* Translates the origin by (x, y).
*/
public void translate(int x, int y)
{
translateX += x;
translateY += y;
if (clip != null)
{
clip.x -= x;
clip.y -= y;
}
}
/**
* Returns the current foreground color, possibly <code>null</code>.
*
* @return the current foreground color, possibly <code>null</code>
*/
public Color getColor()
{
return foreground;
}
/**
* Sets the current foreground color. A <code>null</code> value doesn't
* change the current setting.
*
* @param c the foreground color to set
*/
public void setColor(Color c)
{
if (c != null)
{
XToolkit tk = (XToolkit) Toolkit.getDefaultToolkit();
HashMap colorMap = tk.colorMap;
gnu.x11.Color col = (gnu.x11.Color) colorMap.get(c);
if (col == null)
{
Colormap map = xdrawable.display.default_colormap;
col = map.alloc_color (c.getRed() * 256,
c.getGreen() * 256,
c.getBlue() * 256);
colorMap.put(c, col);
}
xgc.set_foreground(col);
foreground = c;
}
}
public void setPaintMode()
{
// FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented");
}
public void setXORMode(Color color)
{
// FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Returns the current font, possibly <code>null</code>.
*
* @return the current font, possibly <code>null</code>
*/
public Font getFont()
{
return font;
}
/**
* Sets the font on the graphics context. A <code>null</code> value doesn't
* change the current setting.
*
* @param f the font to set
*/
public void setFont(Font f)
{
if (f != null)
{
XFontPeer xFontPeer = (XFontPeer) f.getPeer();
xgc.set_font(xFontPeer.getXFont());
font = f;
}
}
/**
* Returns the font metrics for the specified font.
*
* @param font the font for which we want the font metrics
*
* @return the font metrics for the specified font
*/
public FontMetrics getFontMetrics(Font font)
{
if (font == null)
{
if (this.font == null)
setFont(new Font("Dialog", Font.PLAIN, 12));
font = this.font;
}
XFontPeer xFontPeer = (XFontPeer) font.getPeer();
return xFontPeer.getFontMetrics(font);
}
/**
* Returns the bounds of the current clip.
*
* @return the bounds of the current clip
*/
public Rectangle getClipBounds()
{
return clip != null ? clip.getBounds() : null;
}
/**
* Clips the current clip with the specified clip.
*/
public void clipRect(int x, int y, int width, int height)
{
if (clip == null)
{
clip = new Rectangle(x, y, width, height);
}
else
{
computeIntersection(x, y, width, height, clip);
}
// Update the X clip setting.
setXClip(clip.x, clip.y, clip.width, clip.height);
}
/**
* Returns <code>true</code> when the specified rectangle intersects with
* the current clip, <code>false</code> otherwise. This is overridden to
* avoid unnecessary creation of Rectangles via getBounds().
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
* @param w the width of the rectangle
* @param h the height of the rectangle
*
* @return <code>true</code> when the specified rectangle intersects with
* the current clip, <code>false</code> otherwise
*/
public boolean hitClip(int x, int y, int w, int h)
{
boolean hit;
if (clip == null)
{
hit = true;
}
else
{
// It's easier to determine if the rectangle lies outside the clip,
// so we determine that and reverse the result (if it's not completely
// outside, it most likely hits the clip rectangle).
int x2 = x + w;
int y2 = y + h;
int clipX2 = clip.x + clip.width;
int clipY2 = clip.y + clip.height;
boolean outside = (x < clip.x && x2 < clip.x) // Left.
|| (x > clipX2 && x2 > clipX2) // Right.
|| (y < clip.y && y2 < clip.y) // Top.
|| (y > clipY2 && y2 > clipY2); // Bottom.
hit = ! outside;
}
return hit;
}
public void setClip(int x, int y, int width, int height)
{
if (clip != null)
clip.setBounds(x, y, width, height);
else
clip = new Rectangle(x, y, width, height);
setXClip(clip.x, clip.y, clip.width, clip.height);
}
/**
* Sets the clip on the X server GC. The coordinates are not yet translated,
* this will be performed by the X server.
*
* @param x the clip, X coordinate
* @param y the clip, Y coordinate
* @param w the clip, width
* @param h the clip, height
*/
private void setXClip(int x, int y, int w, int h)
{
gnu.x11.Rectangle[] clipRects = new gnu.x11.Rectangle[] {
new gnu.x11.Rectangle(x, y, w, h) };
xgc.set_clip_rectangles(translateX, translateY, clipRects, GC.YX_BANDED);
}
public Shape getClip()
{
// Return a copy here, so nobody can trash our clip.
return clip == null ? null : clip.getBounds();
}
/**
* Sets the current clip.
*
* @param c the clip to set
*/
public void setClip(Shape c)
{
if (c != null)
{
Rectangle b;
if (c instanceof Rectangle)
{
b = (Rectangle) c;
}
else
{
b = c.getBounds();
}
clip.setBounds(b);
setXClip(b.x, b.y, b.width, b.height);
}
else
{
clip.setBounds(0, 0, xdrawable.width, xdrawable.height);
setXClip(0, 0, xdrawable.width, xdrawable.height);
}
}
public void copyArea(int x, int y, int width, int height, int dx, int dy)
{
// Clip and translate src rectangle.
int srcX = Math.min(Math.max(x, clip.x), clip.x + clip.width)
+ translateX;
int srcY = Math.min(Math.max(y, clip.y), clip.y + clip.height)
+ translateY;
int srcWidth = Math.min(Math.max(x + width, clip.x),
clip.x + clip.width) - x;
int srcHeight = Math.min(Math.max(y + height, clip.y),
clip.y + clip.height) - y;
xdrawable.copy_area(xdrawable, xgc, srcX, srcY, srcWidth, srcHeight,
srcX + dx, srcY + dy);
}
/**
* Draws a line from point (x1, y1) to point (x2, y2).
*/
public void drawLine(int x1, int y1, int x2, int y2)
{
//System.err.println("drawLine: " + (x1 + translateX) + ", " + ( y1 + translateY) + ", " + (x2 + translateX) + ", " + (y2 + translateY) + " on: " + xdrawable);
xdrawable.line(xgc, x1 + translateX, y1 + translateY,
x2 + translateX, y2 + translateY);
}
/**
* Fills the specified rectangle.
*/
public void fillRect(int x, int y, int width, int height)
{
xdrawable.rectangle(xgc, x + translateX, y + translateY,
width, height, true);
}
public void clearRect(int x, int y, int width, int height)
{
xgc.set_foreground(Color.WHITE.getRGB());
xdrawable.rectangle(xgc, x, y, width, height, true);
if (foreground != null)
xgc.set_foreground(foreground.getRGB());
}
public void drawRoundRect(int x, int y, int width, int height, int arcWidth,
int arcHeight)
{
// Draw 4 lines.
int arcRadiusX = arcWidth / 2;
int arcRadiusY = arcHeight / 2;
drawLine(x + arcRadiusX, y, x + width - arcRadiusX, y);
drawLine(x, y + arcRadiusY, x, y + height - arcRadiusY);
drawLine(x + arcRadiusX, y + height, x + width - arcRadiusX, y + height);
drawLine(x + width, y + arcRadiusY, x + width, y + height - arcRadiusY);
// Draw the 4 arcs at the corners.
// Upper left.
drawArc(x, y, arcWidth, arcHeight, 90, 90);
// Lower left.
drawArc(x, y + height - arcHeight, arcWidth, arcHeight, 180, 90);
// Upper right.
drawArc(x + width - arcWidth, y, arcWidth, arcHeight, 0, 90);
// Lower right.
drawArc(x + width - arcWidth, y + height - arcHeight, arcWidth, arcHeight,
270, 90);
}
public void fillRoundRect(int x, int y, int width, int height, int arcWidth,
int arcHeight)
{
// Fill the 3 rectangles that make up the inner area.
int arcRadiusX = arcWidth / 2;
int arcRadiusY = arcHeight / 2;
// Left.
fillRect(x, y + arcRadiusY, arcRadiusX, height - arcHeight);
// Middle.
fillRect(x + arcRadiusX, y, width - arcWidth, height);
// Right.
fillRect(x + width - arcRadiusX, y + arcRadiusY, arcRadiusX,
height - arcHeight);
// Fill the 4 arcs in the corners.
// Upper left.
fillArc(x, y, arcWidth, arcHeight, 90, 90);
// Lower left.
fillArc(x, y + height - arcHeight, arcWidth, arcHeight, 180, 90);
// Upper right.
fillArc(x + width - arcWidth, y, arcWidth, arcHeight, 0, 90);
// Lower right.
fillArc(x + width - arcWidth, y + height - arcHeight, arcWidth, arcHeight,
270, 90);
}
public void drawOval(int x, int y, int width, int height)
{
xdrawable.arc(xgc, x, y, width, height, 0, 360 * 64, false);
}
public void fillOval(int x, int y, int width, int height)
{
xdrawable.arc(xgc, x, y, width, height, 0, 360 * 64, true);
}
public void drawArc(int x, int y, int width, int height, int arcStart,
int arcAngle)
{
xdrawable.arc(xgc, x, y, width, height, arcStart * 64, arcAngle * 64, false);
}
public void fillArc(int x, int y, int width, int height, int arcStart,
int arcAngle)
{
xdrawable.arc(xgc, x, y, width, height, arcStart * 64, arcAngle * 64, true);
}
public void drawPolyline(int[] xPoints, int[] yPoints, int npoints)
{
int numPoints = Math.min(xPoints.length, yPoints.length);
Point[] points = new Point[numPoints];
// FIXME: Improve Escher API to accept arrays to avoid creation
// of many Point objects.
for (int i = 0; i < numPoints; i++)
points[i] = new Point(xPoints[i], yPoints[i]);
xdrawable.poly_line(xgc, points, Drawable.ORIGIN);
}
public void drawPolygon(int[] xPoints, int[] yPoints, int npoints)
{
int numPoints = Math.min(xPoints.length, yPoints.length);
Point[] points = new Point[numPoints];
// FIXME: Improve Escher API to accept arrays to avoid creation
// of many Point objects.
for (int i = 0; i < numPoints; i++)
points[i] = new Point(xPoints[i], yPoints[i]);
xdrawable.poly_line(xgc, points, Drawable.ORIGIN);
}
public void fillPolygon(int[] xPoints, int[] yPoints, int npoints)
{
int numPoints = Math.min(xPoints.length, yPoints.length);
Point[] points = new Point[numPoints];
// FIXME: Improve Escher API to accept arrays to avoid creation
// of many Point objects.
for (int i = 0; i < numPoints; i++)
points[i] = new Point(xPoints[i], yPoints[i]);
xdrawable.fill_poly(xgc, points, Drawable.COMPLEX, Drawable.ORIGIN);
}
/**
* Draws the specified string at (x, y).
*/
public void drawString(String string, int x, int y)
{
if (disposed)
throw new AWTError("XGraphics already disposed");
xdrawable.text(xgc, x + translateX, y + translateY, string);
}
public void drawString(AttributedCharacterIterator ci, int x, int y)
{
// FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Draws the specified image on the drawable at position (x,y).
*/
public boolean drawImage(Image image, int x, int y, ImageObserver observer)
{
if (image instanceof XImage)
{
XImage xim = (XImage) image;
Pixmap pm = xim.pixmap;
xdrawable.copy_area(pm, xgc, 0, 0, pm.width, pm.height,
x + translateX, y + translateY);
}
else if (image instanceof BufferedImage
&& ((BufferedImage) image).getTransparency() != Transparency.OPAQUE)
{
BufferedImage bi = (BufferedImage) image;
int width = bi.getWidth();
int height = bi.getHeight();
Data img = xdrawable.image(x + translateX, y + translateY,
width, height, 0xFFFFFFFF, 2);
// Compute line byte count.
int lineBitCount = width * pixmapFormat.bits_per_pixel ();
int rem = lineBitCount % pixmapFormat.scanline_pad ();
int linePadCount = lineBitCount / pixmapFormat.scanline_pad ()
+ (rem == 0 ? 0 : 1);
int lineByteCount = linePadCount * pixmapFormat.scanline_pad () / 8;
// Composite source and destination pixel data.
int[] trgb = new int[3]; // The device rgb pixels.
for (int yy = 0; yy < height; yy++)
{
for (int xx = 0; xx < width; xx++)
{
getRGB(xx, yy, img, trgb, lineByteCount);
int srgb = bi.getRGB(xx, yy);
float alpha = ((srgb >> 24) & 0xff) / 256F;
float tAlpha = 1.F - alpha;
int red = (srgb >> 16) & 0xFF;
int green = (srgb >> 8) & 0xFF;
int blue = (srgb) & 0xFF;
trgb[0] = (int) (trgb[0] * tAlpha + red * alpha);
trgb[1] = (int) (trgb[1] * tAlpha + green * alpha);
trgb[2] = (int) (trgb[2] * tAlpha + blue * alpha);
setRGB(xx, yy, img, trgb, lineByteCount);
}
}
// Now we have the transparent image composited onto the target
// Image, now we only must copy it to the Drawable.
ZPixmap pm = new ZPixmap(xdrawable.display);
pm.width = width;
pm.height = height;
pm.init();
System.arraycopy(img.data, 32, pm.data, 0, img.data.length - 32);
xdrawable.put_image(xgc, pm, x + translateX, y + translateY);
}
else
{
// Pre-render the image into an XImage.
ImageProducer source = image.getSource();
ImageConverter conv = new ImageConverter();
source.startProduction(conv);
XImage xim = conv.getXImage();
Pixmap pm = xim.pixmap;
xdrawable.copy_area(pm, xgc, 0, 0, pm.width, pm.height,
x + translateX, y + translateY);
}
return true;
}
/**
* Helper method to work around limitation in the current Escher impl.
*
* @param x the x position
* @param y the y position
* @param img the image data
* @param rgb an 3-size array that holds the rgb values on method exit
*/
private void getRGB(int x, int y, Data img, int[] rgb, int lineByteCount)
{
// TODO: Does this also work on non-RGB devices?
int i = y * lineByteCount + pixelByteCount * x;
if (imageByteOrder == gnu.x11.image.Image.LSB_FIRST)
{//if (i >= 5716-33) System.err.println("lbc: " + lineByteCount + ", " + pixelByteCount);
rgb[2] = img.data[32 + i];
rgb[1] = img.data[32 + i + 1];
rgb[0] = img.data[32 + i + 2];
}
else
{ // MSB_FIRST
rgb[0] = img.data[32 + i];
rgb[1] = img.data[32 + i + 1];
rgb[2] = img.data[32 + i + 2];
}
}
/**
* Helper method to work around limitation in the current Escher impl.
*
* @param x the x position
* @param y the y position
* @param img the image data
* @param rgb an 3-size array that holds the rgb values on method exit
*/
private void setRGB(int x, int y, Data img, int[] rgb, int lineByteCount)
{
// TODO: Does this also work on non-RGB devices?
int i = y * lineByteCount + pixelByteCount * x;
if (imageByteOrder == gnu.x11.image.Image.LSB_FIRST)
{
img.data[32 + i] = (byte) rgb[2];
img.data[32 + i + 1] = (byte) rgb[1];
img.data[32 + i + 2] = (byte) rgb[0];
}
else
{ // MSB_FIRST
img.data[32 + i] = (byte) rgb[0];
img.data[32 + i + 1] = (byte) rgb[1];
img.data[32 + i + 2] = (byte) rgb[2];
}
}
public boolean drawImage(Image image, int x, int y, int width, int height,
ImageObserver observer)
{
// FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented");
}
public boolean drawImage(Image image, int x, int y, Color bgcolor,
ImageObserver observer)
{
// FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented");
}
public boolean drawImage(Image image, int x, int y, int width, int height,
Color bgcolor, ImageObserver observer)
{
// FIXME: Implement this.
throw new UnsupportedOperationException("Not yet implemented");
}
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
ImageObserver observer)
{
return drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null,
observer);
}
public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2, Color bgcolor,
ImageObserver observer)
{
// FIXME: What to do with bgcolor?
// Scale the image.
int sw = image.getWidth(observer);
int sh = image.getHeight(observer);
double scaleX = Math.abs(dx2 - dx1) / (double) Math.abs(sx2 - sx1);
double scaleY = Math.abs(dy2 - dy1) / (double) Math.abs(sy2 - sy1);
Image scaled = image.getScaledInstance((int) (scaleX * sw),
(int) (scaleY * sh),
Image.SCALE_FAST);
// Scaled source coordinates.
int sx1s = (int) (scaleX * Math.min(sx1, sx2));
int sx2s = (int) (scaleX * Math.max(sx1, sx2));
// Temporarily clip to the target rectangle.
Rectangle old = clip;
clipRect(dx1, dy1, dx2 - dx1, dy2 - dy1);
// Draw scaled image.
boolean res = drawImage(scaled, dx1 - sx1s, dy1 - sx2s, observer);
// Reset clip.
setClip(old);
return res;
}
/**
* Frees any resources associated with this object.
*/
public void dispose()
{
if (! disposed)
{
xgc.free();
xdrawable.display.flush();
disposed = true;
}
}
// Additional helper methods.
/**
* Creates and returns an exact copy of this XGraphics.
*/
protected Object clone()
{
try
{
XGraphics copy = (XGraphics) super.clone();
copy.xgc = xgc.copy();
if (clip != null)
{
copy.clip = new Rectangle(clip);
copy.setXClip(clip.x, clip.y, clip.width, clip.height);
}
return copy;
}
catch (CloneNotSupportedException ex)
{
assert false;
}
return null;
}
/**
* Computes the intersection between two rectangles and stores the result
* int the second rectangle.
*
* This method has been copied from {@link javax.swing.SwingUtilities}.
*
* @param x the x coordinate of the rectangle #1
* @param y the y coordinate of the rectangle #1
* @param w the width of the rectangle #1
* @param h the height of the rectangle #1
* @param rect the rectangle #2 and output rectangle
*/
private static void computeIntersection(int x, int y, int w, int h,
Rectangle rect)
{
int x2 = (int) rect.x;
int y2 = (int) rect.y;
int w2 = (int) rect.width;
int h2 = (int) rect.height;
int dx = (x > x2) ? x : x2;
int dy = (y > y2) ? y : y2;
int dw = (x + w < x2 + w2) ? (x + w - dx) : (x2 + w2 - dx);
int dh = (y + h < y2 + h2) ? (y + h - dy) : (y2 + h2 - dy);
if (dw >= 0 && dh >= 0)
rect.setBounds(dx, dy, dw, dh);
else
rect.setBounds(0, 0, 0, 0);
}
}

View File

@ -37,16 +37,23 @@ exception statement from your version. */
package gnu.java.awt.peer.x;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Toolkit;
import java.awt.geom.AffineTransform;
import java.awt.image.ColorModel;
import java.awt.image.ImageObserver;
import java.awt.image.Raster;
import java.util.HashMap;
import gnu.java.awt.java2d.AbstractGraphics2D;
import gnu.java.awt.java2d.ScanlineCoverage;
import gnu.x11.Colormap;
import gnu.x11.Drawable;
import gnu.x11.GC;
import gnu.x11.image.ZPixmap;
@ -70,6 +77,11 @@ public class XGraphics2D
*/
private boolean disposed;
/**
* The current foreground color, possibly null.
*/
private Color foreground;
XGraphics2D(Drawable d)
{
super();
@ -80,31 +92,9 @@ public class XGraphics2D
//setClip(new Rectangle(0, 0, xdrawable.width, xdrawable.height));
}
/**
* Draws a pixel in the target coordinate space using the specified color.
*
* @param x the x coordinate
* @param y the y coordinate
*/
protected void rawSetPixel(int x, int y)
{
xdrawable.point(xgc, x, y);
}
// protected void rawFillPolygon(double[] xpoints, double[] ypoints, int npoints)
// {
// Point[] points = new Point[npoints];
// for (int n = 0; n < npoints; n++)
// {
// points[n] = new Point((int) xpoints[n], (int) ypoints[n]);
// }
// xdrawable.fill_poly(xgc, points, Drawable.COMPLEX, Drawable.ORIGIN);
// xdrawable.display.flush();
// }
protected void rawDrawLine(int x0, int y0, int x1, int y1)
{
xdrawable.line(xgc, x0, y0, x1, y1);
xdrawable.segment(xgc, x0, y0, x1, y1);
}
protected void rawFillRect(int x, int y, int w, int h)
@ -112,17 +102,6 @@ public class XGraphics2D
xdrawable.rectangle(xgc, x, y, w, h, true);
}
protected void rawSetForeground(java.awt.Color c)
{
if (c != null)
xgc.set_foreground(c.getRGB());
}
protected void rawSetForeground(int r, int g, int b)
{
xgc.set_foreground( r << 16 | g << 8 | b );
}
/**
* Returns the color model of this Graphics object.
*
@ -178,55 +157,6 @@ public class XGraphics2D
return copy;
}
// /**
// * Draws the specified image on the drawable at position (x,y).
// */
//
// public boolean drawImage(Image image, int x, int y, ImageObserver observer)
// {
// AffineTransform transform = getTransform();
// int translateX = (int) transform.getTranslateX();
// int translateY = (int) transform.getTranslateY();
// if (image instanceof XImage)
// {
// XImage xim = (XImage) image;
// Pixmap pm = xim.pixmap;
// xdrawable.copy_area(pm, xgc, 0, 0, pm.width, pm.height,
// x + translateX, y + translateY);
// }
// else if (image instanceof BufferedImage)
// {
// BufferedImage bufferedImage = (BufferedImage) image;
// Raster raster = bufferedImage.getData();
// int w = bufferedImage.getWidth();
// int h = bufferedImage.getHeight();
// // Push data to X server.
// ZPixmap zPixmap = new ZPixmap(xdrawable.display, w, h,
// xdrawable.display.default_pixmap_format);
// System.err.println("data buffer length: " + zPixmap.data.length);
// int[] pixel = new int[4];
// for (int tx = 0; tx < w; tx++)
// {
// for (int ty = 0; ty < h; ty++)
// {
// pixel = raster.getPixel(tx, ty, pixel);
//// System.err.print("r: " + pixel[0]);
//// System.err.print(", g: " + pixel[1]);
//// System.err.println(", b: " + pixel[2]);
// zPixmap.set_red(tx, ty, pixel[0]);
// zPixmap.set_green(tx, ty, pixel[1]);
// zPixmap.set_blue(tx, ty, pixel[2]);
// }
// }
// xdrawable.put_image(xgc, zPixmap, x, y);
// }
// else
// {
// throw new UnsupportedOperationException("Not yet implemented.");
// }
// return true;
// }
//
public void setClip(Shape c)
{
super.setClip(c);
@ -287,9 +217,115 @@ public class XGraphics2D
}
}
public void renderScanline(int y, ScanlineCoverage c)
{
ScanlineCoverage.Iterator iter = c.iterate();
float coverageAlpha = 0;
int maxCoverage = c.getMaxCoverage();
Color old = getColor();
Color col = getColor();
if (col == null)
col = Color.BLACK;
while (iter.hasNext())
{
ScanlineCoverage.Range range = iter.next();
// TODO: Dumb implementation for testing.
coverageAlpha = range.getCoverage();
if (coverageAlpha > 0)
{
int red = col.getRed();
int green = col.getGreen();
int blue = col.getBlue();
if (coverageAlpha < c.getMaxCoverage())
{
float alpha = coverageAlpha / maxCoverage;
red = 255 - (int) ((255 - red) * alpha);
green = 255 - (int) ((255 - green) * alpha);
blue = 255 - (int) ((255 - blue) * alpha);
}
xgc.set_foreground(red << 16 | green << 8 | blue);
int x0 = range.getXPos();
int l = range.getLength();
xdrawable.fill_rectangle(xgc, x0, y, l, 1);
}
}
if (old != null)
xgc.set_foreground(old.getRGB());
}
protected void fillScanline(int x0, int x1, int y)
{
xdrawable.segment(xgc, x0, y, x1, y);
}
protected void fillScanlineAA(int x0, int x1, int y, int alpha)
{
//System.err.println("fillScanlineAA: " + x0 + ", " + x1 + ", " + y + ", " + alpha);
// FIXME: This is for testing only.
Color c = getColor();
setColor(new Color(255-alpha, 255-alpha, 255-alpha));
xdrawable.segment(xgc, x0, y, x1, y);
setColor(c);
}
protected void init()
{
super.init();
}
public void setPaint(Paint p)
{
super.setPaint(p);
if (p instanceof Color)
{
Color c = (Color) p;
XToolkit tk = (XToolkit) Toolkit.getDefaultToolkit();
HashMap colorMap = tk.colorMap;
gnu.x11.Color col = (gnu.x11.Color) colorMap.get(c);
if (col == null)
{
Colormap map = xdrawable.display.default_colormap;
col = map.alloc_color (c.getRed() * 256,
c.getGreen() * 256,
c.getBlue() * 256);
colorMap.put(c, col);
}
xgc.set_foreground(col);
foreground = c;
}
}
protected void fillShape(Shape s, boolean isFont)
{
synchronized (xdrawable.display) {
super.fillShape(s, isFont);
}
}
protected boolean rawDrawImage(Image image, int x, int y, ImageObserver obs)
{
boolean ret;
if (image instanceof XImage)
{
XImage xImage = (XImage) image;
xdrawable.copy_area(xImage.pixmap, xgc, 0, 0, xImage.getWidth(obs),
xImage.getHeight(obs), x, y);
ret = true;
}
else if (image instanceof PixmapVolatileImage)
{
PixmapVolatileImage pvi = (PixmapVolatileImage) image;
xdrawable.copy_area(pvi.getPixmap(), xgc, 0, 0, pvi.getWidth(obs),
pvi.getHeight(obs), x, y);
ret = true;
}
else
{
ret = super.rawDrawImage(image, x, y, obs);
}
return ret;
}
}

View File

@ -39,11 +39,20 @@ package gnu.java.awt.peer.x;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.ComponentColorModel;
import java.awt.image.ComponentSampleModel;
import java.awt.image.DataBuffer;
import java.awt.image.Raster;
import java.awt.image.SampleModel;
import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
public class XGraphicsConfiguration
extends GraphicsConfiguration
@ -63,26 +72,60 @@ public class XGraphicsConfiguration
public BufferedImage createCompatibleImage(int w, int h)
{
return new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
return createCompatibleImage(w, h, Transparency.OPAQUE);
}
public BufferedImage createCompatibleImage(int w, int h, int transparency)
{
BufferedImage bi;
switch (transparency)
{
case Transparency.OPAQUE:
DataBuffer buffer = new ZPixmapDataBuffer(w, h);
SampleModel sm = new ComponentSampleModel(DataBuffer.TYPE_BYTE, w, h,
4, w * 4,
new int[]{0, 1, 2, 3 });
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB);
ColorModel cm = new ComponentColorModel(cs, true, false,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
WritableRaster raster = Raster.createWritableRaster(sm, buffer,
new Point(0, 0));
bi = new BufferedImage(cm, raster, false, null);
break;
case Transparency.BITMASK:
case Transparency.TRANSLUCENT:
bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
break;
default:
throw new IllegalArgumentException("Illegal transparency: "
+ transparency);
}
return bi;
}
public VolatileImage createCompatibleVolatileImage(int w, int h)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
return createCompatibleVolatileImage(w, h, Transparency.OPAQUE);
}
public VolatileImage createCompatibleVolatileImage(int width, int height,
int transparency)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
}
public BufferedImage createCompatibleImage(int w, int h, int transparency)
{
// TODO: Implement this.
throw new UnsupportedOperationException("Not yet implemented.");
VolatileImage im;
switch (transparency)
{
case Transparency.OPAQUE:
im = new PixmapVolatileImage(width, height);
break;
case Transparency.BITMASK:
case Transparency.TRANSLUCENT:
throw new UnsupportedOperationException("Not yet implemented");
default:
throw new IllegalArgumentException("Unknown transparency type: "
+ transparency);
}
return im;
}
public ColorModel getColorModel()

View File

@ -38,15 +38,12 @@ exception statement from your version. */
package gnu.java.awt.peer.x;
import gnu.classpath.SystemProperties;
import gnu.java.net.local.LocalSocket;
import gnu.java.net.local.LocalSocketAddress;
import gnu.x11.Connection;
import gnu.x11.Display;
import java.awt.AWTError;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.net.SocketException;
import java.lang.reflect.Constructor;
import java.net.Socket;
/**
* This class represents an X Display. The actual connection is established
@ -127,33 +124,21 @@ public class XGraphicsDevice
|| displayName.hostname.equals(""))
&& SystemProperties.getProperty("gnu.xawt.no_local_sockets") == null)
{
// TODO: Is this 100% ok?
String sockPath = "/tmp/.X11-unix/X" + displayName.display_no;
LocalSocketAddress addr = new LocalSocketAddress(sockPath);
try
Socket socket = createLocalSocket();
if (socket != null)
{
if (XToolkit.DEBUG)
System.err.println("connecting to local socket: "
+ sockPath);
LocalSocket socket = new LocalSocket(addr);
display = new Display(socket, "localhost",
displayName.display_no,
displayName.screen_no);
display.connection.send_mode = Connection.ASYNCHRONOUS;
if (XToolkit.DEBUG)
System.err.println("connected to local socket");
}
catch (SocketException ex)
{
AWTError err = new AWTError("could not connect to X server");
err.initCause(ex);
throw err;
}
}
else
{
display = new Display(displayName);
}
// The following happens when we are configured to use plain sockets,
// when the connection is probably remote or when we couldn't load
// the LocalSocket class stuff.
if (display == null)
display = new Display(displayName);
eventPump = new XEventPump(display);
}
return display;
@ -163,4 +148,36 @@ public class XGraphicsDevice
{
return eventPump;
}
/**
* Tries to load the LocalSocket class and initiate a connection to the
* local X server.
*/
private Socket createLocalSocket()
{
Socket socket = null;
try
{
// TODO: Is this 100% ok?
String sockPath = "/tmp/.X11-unix/X" + displayName.display_no;
Class localSocketAddressClass =
Class.forName("gnu.java.net.local.LocalSocketAddress");
Constructor localSocketAddressConstr =
localSocketAddressClass.getConstructor(new Class[]{ String.class });
Object addr =
localSocketAddressConstr.newInstance(new Object[]{ sockPath });
Class localSocketClass =
Class.forName("gnu.java.net.local.LocalSocket");
Constructor localSocketConstructor =
localSocketClass.getConstructor(new Class[]{localSocketAddressClass});
Object localSocket =
localSocketConstructor.newInstance(new Object[]{ addr });
socket = (Socket) localSocket;
}
catch (Exception ex)
{
// Whatever goes wrong here, we return null.
}
return socket;
}
}

View File

@ -86,7 +86,7 @@ public class XImage
*/
public Graphics getGraphics()
{
XGraphics g = new XGraphics(pixmap);
XGraphics2D g = new XGraphics2D(pixmap);
return g;
}

View File

@ -44,7 +44,6 @@ import java.awt.Canvas;
import java.awt.Checkbox;
import java.awt.CheckboxMenuItem;
import java.awt.Choice;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.EventQueue;
@ -69,6 +68,8 @@ import java.awt.TextArea;
import java.awt.TextField;
import java.awt.Transparency;
import java.awt.Window;
import java.awt.Dialog.ModalExclusionType;
import java.awt.Dialog.ModalityType;
import java.awt.datatransfer.Clipboard;
import java.awt.dnd.DragGestureEvent;
import java.awt.dnd.peer.DragSourceContextPeer;
@ -88,7 +89,6 @@ import java.awt.peer.FileDialogPeer;
import java.awt.peer.FontPeer;
import java.awt.peer.FramePeer;
import java.awt.peer.LabelPeer;
import java.awt.peer.LightweightPeer;
import java.awt.peer.ListPeer;
import java.awt.peer.MenuBarPeer;
import java.awt.peer.MenuItemPeer;
@ -179,16 +179,16 @@ public class XToolkit
*/
public ClasspathFontPeer getClasspathFontPeer(String name, Map attrs)
{
String canonical = XFontPeer.encodeFont(name, attrs);
String canonical = XFontPeer2.encodeFont(name, attrs);
ClasspathFontPeer font;
if (!fontCache.containsKey(canonical))
{
String graphics2d =
SystemProperties.getProperty("gnu.xawt.graphics2d");
if (graphics2d != null && graphics2d.equals("gl"))
//if (graphics2d != null && graphics2d.equals("gl"))
font = new XFontPeer2(name, attrs);
else
font = new XFontPeer(name, attrs);
// else
// font = new XFontPeer(name, attrs);
fontCache.put(canonical, font);
}
else
@ -601,8 +601,20 @@ public class XToolkit
return (XGraphicsDevice) env.getDefaultScreenDevice();
}
protected LightweightPeer createComponent(Component c)
@Override
public boolean isModalExclusionTypeSupported
(Dialog.ModalExclusionType modalExclusionType)
{
return new XLightweightPeer(c);
// TODO: Implement properly.
return false;
}
@Override
public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
{
// TODO: Implement properly.
return false;
}
}

View File

@ -43,12 +43,16 @@ import java.awt.EventQueue;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.PaintEvent;
import java.awt.event.WindowEvent;
import java.awt.image.VolatileImage;
import gnu.x11.Window;
import gnu.x11.event.Event;
@ -135,12 +139,22 @@ public class XWindowPeer
*/
public Graphics getGraphics()
{
return new XGraphics(xwindow);
return new XGraphics2D(xwindow);
}
public Image createImage(int w, int h)
{
return new XImage(w, h);
// FIXME: Should return a buffered image.
return createVolatileImage(w, h);
}
@Override
public VolatileImage createVolatileImage(int width, int height)
{
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
GraphicsConfiguration gc = gd.getDefaultConfiguration();
return gc.createCompatibleVolatileImage(width, height);
}
/**
@ -168,6 +182,9 @@ public class XWindowPeer
new Rectangle(0, 0, w.getWidth(),
w.getHeight())));
Graphics g = getGraphics();
g.clearRect(0, 0, awtComponent.getWidth(), awtComponent.getHeight());
g.dispose();
// // Reset input selection.
// atts.set_override_redirect(false);
// xwindow.change_attributes(atts);
@ -240,7 +257,7 @@ public class XWindowPeer
*/
public FontMetrics getFontMetrics(Font font)
{
XFontPeer fontPeer = (XFontPeer) font.getPeer();
XFontPeer2 fontPeer = (XFontPeer2) font.getPeer();
return fontPeer.getFontMetrics(font);
}

View File

@ -0,0 +1,62 @@
package gnu.java.awt.peer.x;
import gnu.x11.Display;
import gnu.x11.image.ZPixmap;
import java.awt.GraphicsEnvironment;
import java.awt.image.DataBuffer;
/**
* A DataBuffer implementation that is based on a ZPixmap. This is used
* as backing store for BufferedImages.
*/
class ZPixmapDataBuffer
extends DataBuffer
{
/**
* The backing ZPixmap.
*/
private ZPixmap zpixmap;
/**
* Creates a new ZPixmapDataBuffer with a specified width and height.
*
* @param d the X display
* @param w the width
* @param h the height
*/
ZPixmapDataBuffer(int w, int h)
{
super(TYPE_BYTE, w * h * 3); // TODO: Support non-24-bit-resolutions.
GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
XGraphicsDevice dev = (XGraphicsDevice) env.getDefaultScreenDevice();
Display d = dev.getDisplay();
zpixmap = new ZPixmap(d, w, h, d.default_pixmap_format);
}
/**
* Creates a ZPixmapDataBuffer from an existing ZPixmap.
*
* @param zpixmap the ZPixmap to wrap
*/
ZPixmapDataBuffer(ZPixmap zpixmap)
{
super(TYPE_BYTE, zpixmap.get_data_length());
this.zpixmap = zpixmap;
}
@Override
public int getElem(int bank, int i)
{
return 0xff & zpixmap.get_data_element(i);
}
@Override
public void setElem(int bank, int i, int val)
{
zpixmap.set_data_element(i, (byte) val);
}
}

View File

@ -108,6 +108,19 @@ public final class Fixed
return a & -(1 << n);
}
/**
* Truncates the number so that only the digits after the point are left.
*
* @param n the number of digits
* @param a the fixed point value
*
* @return the truncated value
*/
public static int trunc(int n, int a)
{
return a & (0xFFFFFFFF >>> 32 - n);
}
/**
* Returns the round value of a fixed point value <code>a</code> with
* the <code>n</code> digits.

View File

@ -42,6 +42,7 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLStreamHandlerFactory;
import java.security.CodeSource;
import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.jar.Manifest;
@ -95,7 +96,7 @@ public abstract class URLLoader
this.baseURL = baseURL;
this.factory = factory;
this.cache = cache;
this.noCertCodeSource = new CodeSource(overrideURL, null);
this.noCertCodeSource = new CodeSource(overrideURL, (Certificate[]) null);
}
/**

View File

@ -71,8 +71,12 @@ final class ISO_8859_1 extends Charset
/* These names are provided by
* http://oss.software.ibm.com/cgi-bin/icu/convexp?s=ALL
*/
"ISO8859_1", "ISO_8859_1", "ibm-819", "ISO_8859-1:1987",
"819"
"ISO8859_1",
"ISO_8859_1",
"ibm-819",
"ISO_8859-1:1987",
"819",
"ISO8859-1"
});
}

View File

@ -146,7 +146,7 @@ public final class Engine
throw new IllegalArgumentException("Constructor's parameters MUST NOT be null");
Enumeration enumer = provider.propertyNames();
String key;
String key = null;
String alias;
int count = 0;
boolean algorithmFound = false;
@ -193,7 +193,7 @@ public final class Engine
Class clazz = null;
ClassLoader loader = provider.getClass().getClassLoader();
Constructor constructor = null;
String className = provider.getProperty(service + "." + algorithm);
String className = provider.getProperty(key);
sb.append("Class [").append(className).append("] for algorithm [")
.append(algorithm).append("] of type [").append(service)
.append("] from provider [").append(provider).append("] ");

View File

@ -0,0 +1,41 @@
package gnu.javax.sound;
import javax.sound.sampled.AudioPermission;
public class AudioSecurityManager
{
public static enum Permission
{
PLAY, RECORD, ALL
}
public static final void checkPermissions()
{
checkPermissions(Permission.ALL);
}
public static final void checkPermissions(Permission permission)
{
SecurityManager sm = System.getSecurityManager();
if (sm != null)
{
String perm = null;
switch (permission)
{
case PLAY:
perm = "play";
break;
case RECORD:
perm = "record";
break;
case ALL: default:
perm = "*";
break;
}
sm.checkPermission(new AudioPermission(perm));
}
}
}

View File

@ -0,0 +1,270 @@
/* GStreamerMixer.java -- Mixer implementation.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer;
import java.awt.AWTPermission;
import gnu.javax.sound.sampled.gstreamer.lines.GstSourceDataLine;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioPermission;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Control;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.Line;
import javax.sound.sampled.LineListener;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.Control.Type;
import javax.sound.sampled.Line.Info;
/**
* @author Mario Torre <neugens@limasoftware.net>
*/
public class GStreamerMixer
implements Mixer
{
public static class GstInfo extends Info
{
/* Mixer Properties */
/** Name */
private static final String name = "Classpath GStreamer Sound Audio Engine";
/** Vendor */
private static final String vendor = "GNU Classpath";
/** Description */
private static final String desc = "GStreamer-based software mixer";
/** Version */
private static final String vers = "0.0.1";
protected GstInfo()
{
super(name, vendor, desc, vers);
}
}
public static final String GST_BACKEND = GstInfo.name;
public static final String GST_DECODER = "decoder";
private static AudioFormat[] BASIC_FORMATS =
{
new AudioFormat(AudioFormat.Encoding.PCM_UNSIGNED,
AudioSystem.NOT_SPECIFIED,
AudioSystem.NOT_SPECIFIED,
AudioSystem.NOT_SPECIFIED,
AudioSystem.NOT_SPECIFIED,
AudioSystem.NOT_SPECIFIED,
true),
new AudioFormat(AudioFormat.Encoding.PCM_UNSIGNED,
AudioSystem.NOT_SPECIFIED,
AudioSystem.NOT_SPECIFIED,
AudioSystem.NOT_SPECIFIED,
AudioSystem.NOT_SPECIFIED,
AudioSystem.NOT_SPECIFIED,
false),
};
/** Mixer Info */
private static final Mixer.Info INFO = new GStreamerMixer.GstInfo();
public Line getLine(Line.Info info)
throws LineUnavailableException
{
// get all the lines formats supported by this mixer and
// and see if there is one matching the given line
// if the format comes from the gstreamer backend
// gstreamer will be able to deal with it
Class clazz = info.getLineClass();
DataLine.Info _info = (DataLine.Info) info;
if (clazz == SourceDataLine.class)
{
for (AudioFormat format : _info.getFormats())
{
// see if we are a gstreamer child :)
if (format.properties().containsKey(GST_BACKEND));
{
// we got it
return new GstSourceDataLine(format);
}
}
}
// TODO: we also support basic PCM
throw new LineUnavailableException("Cannot open a line");
}
public int getMaxLines(Line.Info info)
{
// TODO
return 1;
}
public Info getMixerInfo()
{
return INFO;
}
public javax.sound.sampled.Line.Info[] getSourceLineInfo()
{
// TODO Auto-generated method stub
return null;
}
public Line.Info[] getSourceLineInfo(Line.Info info)
{
// TODO Auto-generated method stub
return null;
}
public Line[] getSourceLines()
{
// TODO Auto-generated method stub
return null;
}
public javax.sound.sampled.Line.Info[] getTargetLineInfo()
{
// TODO Auto-generated method stub
return null;
}
public Line.Info[] getTargetLineInfo(Line.Info info)
{
// TODO Auto-generated method stub
return null;
}
public Line[] getTargetLines()
{
// TODO Auto-generated method stub
return null;
}
public boolean isLineSupported(Line.Info info)
{
// We support any kind of mixer that comes
// from our gstreamer backend.
// In addition, we support PCM based audio streams for
// direct playback.
if (info instanceof DataLine.Info)
{
DataLine.Info _dinfo = (DataLine.Info) info;
_dinfo.getFormats();
}
return true;
}
public boolean isSynchronizationSupported(Line[] lines, boolean sync)
{
// TODO Auto-generated method stub
return false;
}
public void synchronize(Line[] lines, boolean sync)
{
// TODO Auto-generated method stub
}
public void unsynchronize(Line[] lines)
{
// TODO Auto-generated method stub
}
public void addLineListener(LineListener listener)
{
// TODO Auto-generated method stub
}
public void close()
{
// TODO Auto-generated method stub
}
public Control getControl(Type what)
{
// TODO Auto-generated method stub
return null;
}
public Control[] getControls()
{
// TODO Auto-generated method stub
return null;
}
public javax.sound.sampled.Line.Info getLineInfo()
{
// TODO Auto-generated method stub
return null;
}
public boolean isControlSupported(Type what)
{
// TODO Auto-generated method stub
return false;
}
public boolean isOpen()
{
// TODO Auto-generated method stub
return false;
}
public void open() throws LineUnavailableException
{
// TODO Auto-generated method stub
}
public void removeLineListener(LineListener listener)
{
// TODO Auto-generated method stub
}
}

View File

@ -0,0 +1,71 @@
/*GStreamerMixerProvider -- GNU Classpath GStreamer Mixer provider.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.Mixer.Info;
import javax.sound.sampled.spi.MixerProvider;
/**
* Concrete provider class for GStreamerMixer.
*
* @author Mario Torre
*/
public class GStreamerMixerProvider
extends MixerProvider
{
private static final GStreamerMixer mixer = new GStreamerMixer();
@Override
public Mixer getMixer(Info info)
{
if (info.equals(mixer.getMixerInfo()))
return mixer;
throw new
IllegalArgumentException("This provider cannot handle a mixer or type: "
+ info.getName());
}
@Override
public Info[] getMixerInfo()
{
Info[] info = { mixer.getMixerInfo() };
return info;
}
}

View File

@ -0,0 +1,139 @@
/*GstAudioFileReader -- GNU Classpath GStreamer AudioFileReader.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.io;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;
import javax.sound.sampled.spi.AudioFileReader;
/**
* An implementation of a general AudioFileReader. Uses GStreamer to
* parse and retrieve informations about the file passed as input.
*
* @author Mario Torre <neugens@limasoftware.net>
*/
public class GstAudioFileReader
extends AudioFileReader
{
@Override
public AudioFileFormat getAudioFileFormat(File file)
throws UnsupportedAudioFileException, IOException
{
throw new UnsupportedAudioFileException("Unsupported encoding.");
}
@Override
public AudioFileFormat getAudioFileFormat(InputStream is)
throws UnsupportedAudioFileException, IOException
{
throw new UnsupportedAudioFileException("Unsupported encoding.");
}
@Override
public AudioFileFormat getAudioFileFormat(URL url)
throws UnsupportedAudioFileException, IOException
{
return getAudioFileFormat(new BufferedInputStream(url.openStream()));
}
@Override
public AudioInputStream getAudioInputStream(File file)
throws UnsupportedAudioFileException, IOException
{
InputStream stream = new FileInputStream(file);
long length = file.length();
AudioFormat format = null;
try
{
format = GstAudioFileReaderNativePeer.getAudioFormat(file);
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
// get the header size
if (format == null)
throw new UnsupportedAudioFileException("Unsupported encoding.");
return new AudioInputStream(stream, format, length);
}
@Override
public AudioInputStream getAudioInputStream(InputStream is)
throws UnsupportedAudioFileException, IOException
{
AudioFormat format = null;
try
{
format = GstAudioFileReaderNativePeer.getAudioFormat(is);
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
// get the header size
if (format == null)
throw new UnsupportedAudioFileException("Unsupported encoding.");
return new AudioInputStream(is, format, AudioSystem.NOT_SPECIFIED);
}
@Override
public AudioInputStream getAudioInputStream(URL url)
throws UnsupportedAudioFileException, IOException
{
return getAudioInputStream(new BufferedInputStream(url.openStream()));
}
}

View File

@ -0,0 +1,276 @@
/*GstAudioFileReaderNativePeer -- GNU Classpath GStreamer AudioFileReader
native peer class.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.io;
import gnu.javax.sound.sampled.gstreamer.GStreamerMixer;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.AudioFormat.Encoding;
/**
* GStreamer native peer for GstAudioFileReader.
*
* @author Mario Torre <neugens@limasoftware.net>
*/
final class GstAudioFileReaderNativePeer
{
private static final String GST_ENCODING = "GStreamer Generic Audio Reader";
private static class GstHeader
{
/*
* NOTE: these properties are accessed by the native code, be careful
* if you change them.
* Not all the fields are necessarily set.
*
*/
public String file = null;
public String suffix = null;
public String name = null;
public String mimetype = null;
public String endianness = null;
public String channels = null;
public String rate = null;
public String width = null;
public String depth = null;
public String isSigned = null;
public String layer = null;
public String bitrate = null;
public String framed = null;
public String type = null;
}
public static AudioFormat getAudioFormat(File file) throws Exception
{
GstHeader header = new GstHeader();
header.file = file.getAbsolutePath();
if (!gstreamer_get_audio_format_file(header))
return null;
return getAudioFormat(header);
}
public static AudioFormat getAudioFormat(InputStream is) throws Exception
{
GstHeader header = new GstHeader();
BufferedInputStream stream = new BufferedInputStream(is);
if(!stream.markSupported())
throw new IOException("Stream must support marking.");
stream.mark(0);
if (!gstreamer_get_audio_format_stream(header, stream))
return null;
return getAudioFormat(header);
}
public static AudioFormat getAudioFormat(URL url) throws Exception
{
GstHeader header = new GstHeader();
header.file = url.toExternalForm();
BufferedInputStream stream = new BufferedInputStream(url.openStream());
if(!stream.markSupported())
throw new IOException("Stream must support marking.");
stream.mark(0);
if (!gstreamer_get_audio_format_stream(header, stream))
return null;
return getAudioFormat(header);
}
private static Encoding getEncoding(GstHeader header)
{
StringBuilder buffer = new StringBuilder();
if (header.name == null)
{
buffer.append(GST_ENCODING);
if (header.mimetype != null)
{
buffer.append(" ");
buffer.append(header.mimetype);
}
header.name = buffer.toString();
}
else
{
// strip the "decoder" word from the name, if any
// this is a bit ugly, the alternative would be to still output the
// full name of the decoder/demuxer
String lowerCase = header.name.toLowerCase();
int index = lowerCase.indexOf("decoder");
if (index == -1)
{
index = lowerCase.indexOf("demuxer");
}
if (index == -1)
index = lowerCase.length();
buffer.append(header.name.substring(0, index));
}
return new Encoding(buffer.toString().trim());
}
private static AudioFormat getAudioFormat(GstHeader header)
throws Exception
{
int na = AudioSystem.NOT_SPECIFIED;
/* we use mimetype as an header, but this could have some side effects */
Encoding encoding = getEncoding(header);
float sampleRate = ((header.rate != null) ?
new Float(header.rate).floatValue() : na);
int sampleSizeInBits = ((header.depth != null) ?
new Integer(header.depth).intValue() : na);
int channels = ((header.channels != null) ?
new Integer(header.channels).intValue() : na);
boolean bigEndian = false;
if (header.endianness != null)
{
if (header.endianness.compareTo("4321") == 0)
bigEndian = true;
}
int frameSize = na;
float frameRate = na;
String lowerCase = header.name.toLowerCase();
// FIXME: frameRate = sampleRate in these cases under all the tests so far
// but I'm not sure if this is always correct...
if (lowerCase.contains("law") || lowerCase.contains("au") ||
lowerCase.contains("x-au"))
{
frameSize = (sampleSizeInBits >> 3) * channels;
frameRate = sampleRate;
}
else if (lowerCase.contains("wav"))
{
frameSize = ((sampleSizeInBits + 7) / 8) * channels;
frameRate = sampleRate;
}
else if (lowerCase.contains("iff"))
{
frameSize = (sampleSizeInBits * channels) / 8;
frameRate = sampleRate;
}
// write all the additional properties we got to identify
// the gstreamer plugin actually used to deal with this stream
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(GStreamerMixer.GST_BACKEND, true);
properties.put(GStreamerMixer.GST_DECODER, header.name);
/* now we put in some of the additional properties if we have them */
if (header.type != null) properties.put("type", header.type);
if (header.framed != null) properties.put("framed", header.framed);
if (header.bitrate != null) properties.put("bitrate", header.bitrate);
if (header.isSigned != null) properties.put("isSigned", header.isSigned);
if (header.depth != null) properties.put("depth", header.depth);
if (header.mimetype != null) properties.put("mimetype", header.mimetype);
AudioFormat format = new AudioFormat(encoding,
sampleRate,
sampleSizeInBits,
channels,
frameSize,
frameRate,
bigEndian,
properties);
return format;
}
/* ***** native methods ***** */
/**
* Retrieve header information about the file being played.
*
* @param info
* @return
*/
native static final
protected boolean gstreamer_get_audio_format_stream(GstHeader info,
BufferedInputStream istream);
/**
* Retrieve header information about the file being played.
*
* @param info
* @return
*/
native static final
protected boolean gstreamer_get_audio_format_file(GstHeader info);
static
{
System.loadLibrary("gstreamerpeer"); //$NON-NLS-1$
}
}

View File

@ -1,5 +1,5 @@
/* Magical NSA API -- Associate a C ptr with an instance of an object
Copyright (C) 1998 Free Software Foundation, Inc.
/*GstAudioFileWriter -- GNU Classpath GStreamer AudioFileReader.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -7,7 +7,7 @@ GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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
@ -34,38 +34,47 @@ or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.io;
#ifndef JCL_NATIVE_STATE
#define JCL_NATIVE_STATE
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
#include <jni.h>
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioFileFormat.Type;
import javax.sound.sampled.spi.AudioFileWriter;
struct state_table
public class GstAudioFileWriter
extends AudioFileWriter
{
jint size; /* number of slots, should be prime */
jfieldID hash; /* field containing System.identityHashCode(this) */
jclass clazz; /* lock aquired for reading/writing nodes */
struct state_node **head;
};
@Override
public Type[] getAudioFileTypes()
{
// TODO Auto-generated method stub
return null;
}
struct state_node
{
jint key;
void *c_state;
struct state_node *next;
};
@Override
public Type[] getAudioFileTypes(AudioInputStream ais)
{
// TODO Auto-generated method stub
return null;
}
struct state_table *cp_gtk_init_state_table_with_size (JNIEnv *, jclass, jint);
struct state_table *cp_gtk_init_state_table (JNIEnv *, jclass);
@Override
public int write(AudioInputStream ais, Type type, File out)
throws IOException
{
// TODO Auto-generated method stub
return 0;
}
/* lowlevel api */
void cp_gtk_set_state_oid (JNIEnv *, jobject, struct state_table *, jint, void *);
void *cp_gtk_get_state_oid (JNIEnv *, jobject, struct state_table *, jint);
void *cp_gtk_remove_state_oid (JNIEnv *, jobject, struct state_table *, jint);
@Override
public int write(AudioInputStream ais, Type type, OutputStream os)
throws IOException
{
// TODO Auto-generated method stub
return 0;
}
/* highlevel api */
int cp_gtk_set_state (JNIEnv *, jobject, struct state_table *, void *);
void *cp_gtk_get_state (JNIEnv *, jobject, struct state_table *);
void *cp_gtk_remove_state_slot (JNIEnv *, jobject, struct state_table *);
#endif
}

View File

@ -0,0 +1,145 @@
/* GstDataLine.java -- Abstract DataLine.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.lines;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.Control;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineListener;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Control.Type;
public abstract class GstDataLine
implements DataLine
{
public static enum State
{
PLAY, PAUSE, STOP
}
public static final int DEFAULT_BUFFER_SIZE = 1024;
/** Represents the playing state of this Line. */
protected State state = State.STOP;
/** Represents if this Line is opened or not. */
protected Boolean open = false;
private AudioFormat format = null;
private int bufferSize = 0;
public GstDataLine(AudioFormat format)
{
this.format = format;
this.bufferSize = DEFAULT_BUFFER_SIZE;
}
public GstDataLine(AudioFormat format, int bufferSize)
{
this.format = format;
this.bufferSize = bufferSize;
}
public int getBufferSize()
{
return this.bufferSize;
}
public AudioFormat getFormat()
{
return this.format;
}
public float getLevel()
{
// TODO Auto-generated method stub
return 0;
}
public boolean isRunning()
{
return (state == State.PLAY || state == State.PAUSE);
}
public void addLineListener(LineListener listener)
{
// TODO Auto-generated method stub
}
public Control getControl(Type what)
{
// TODO Auto-generated method stub
return null;
}
public Control[] getControls()
{
// TODO Auto-generated method stub
return null;
}
public javax.sound.sampled.Line.Info getLineInfo()
{
// TODO Auto-generated method stub
return null;
}
public boolean isControlSupported(Type what)
{
return false;
}
public boolean isOpen()
{
// TODO Auto-generated method stub
return false;
}
public void open() throws LineUnavailableException
{
// TODO Auto-generated method stub
}
public void removeLineListener(LineListener listener)
{
// TODO Auto-generated method stub
}
}

View File

@ -1,5 +1,5 @@
/* XLightweightPeer.java -- A lightweight peer for X
Copyright (C) 2006 Free Software Foundation, Inc.
/* GstNativeDataLine.java -- SourceDataLine implementation.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -35,22 +35,14 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.lines;
package gnu.java.awt.peer.x;
import java.awt.Component;
import java.awt.peer.LightweightPeer;
import gnu.java.awt.peer.swing.SwingContainerPeer;
public class XLightweightPeer
extends SwingContainerPeer
implements LightweightPeer
public class GstNativeDataLine
{
XLightweightPeer(Component c)
static
{
super(c);
init(c, null);
System.loadLibrary("gstreamerpeer"); //$NON-NLS-1$
}
}

View File

@ -0,0 +1,57 @@
/* GstPipeline.java -- Represents a Gstreamer Pipeline.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.lines;
import gnu.classpath.Pointer;
/**
*
* @author Mario Torre <neugens@limasoftware.net>
*/
public class GstPipeline
{
/**
* This is the native GStreamer Pipeline.
*
* This field is used by the native code, so any change to it must be
* followed by similar changes in the native peer.
*/
private Pointer pipeline;
native private void setState();
}

View File

@ -0,0 +1,134 @@
/* GstSourceDataLine.java -- SourceDataLine implementation.
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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, or (at your option)
any later version.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.lines;
import gnu.javax.sound.AudioSecurityManager;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import static gnu.javax.sound.AudioSecurityManager.Permission;
public class GstSourceDataLine
extends GstDataLine implements SourceDataLine
{
public GstSourceDataLine(AudioFormat format)
{
super(format);
}
public void open(AudioFormat fmt) throws LineUnavailableException
{
AudioSecurityManager.checkPermissions(Permission.PLAY);
throw new LineUnavailableException("Line unavailable");
}
public void open(AudioFormat fmt, int size) throws LineUnavailableException
{
AudioSecurityManager.checkPermissions(Permission.PLAY);
throw new LineUnavailableException("Line unavailable");
}
public int write(byte[] buf, int offset, int length)
{
// TODO Auto-generated method stub
return 0;
}
public int available()
{
// TODO Auto-generated method stub
return 0;
}
public void drain()
{
// TODO Auto-generated method stub
}
public void flush()
{
// TODO Auto-generated method stub
}
public int getFramePosition()
{
// TODO Auto-generated method stub
return 0;
}
public long getLongFramePosition()
{
// TODO Auto-generated method stub
return 0;
}
public long getMicrosecondPosition()
{
// TODO Auto-generated method stub
return 0;
}
public boolean isActive()
{
// TODO Auto-generated method stub
return false;
}
public void start()
{
// TODO Auto-generated method stub
}
public void stop()
{
// TODO Auto-generated method stub
}
public void close()
{
// TODO Auto-generated method stub
}
}

View File

@ -87,6 +87,7 @@ public class DomDocument
private final DOMImplementation implementation;
private boolean checkingCharacters = true;
boolean checkingWellformedness = true;
private boolean defaultAttributes = true;
boolean building; // if true, skip mutation events in the tree
@ -155,7 +156,15 @@ public class DomDocument
public void setCheckingCharacters(boolean flag)
{
checkingCharacters = flag;
}
}
/**
* Sets whether to default attributes for new elements.
*/
public void setDefaultAttributes(boolean flag)
{
defaultAttributes = flag;
}
/**
* <b>DOM L1</b>
@ -607,7 +616,8 @@ public class DomDocument
domElement.localName = null;
element = domElement;
}
defaultAttributes(element, name);
if (defaultAttributes)
setDefaultAttributes(element, name);
return element;
}
@ -652,11 +662,12 @@ public class DomDocument
}
Element element = new DomElement(this, namespaceURI, name);
defaultAttributes(element, name);
if (defaultAttributes)
setDefaultAttributes(element, name);
return element;
}
private void defaultAttributes(Element element, String name)
private void setDefaultAttributes(Element element, String name)
{
DomDoctype doctype = (DomDoctype) getDoctype();
if (doctype == null)
@ -671,9 +682,11 @@ public class DomDocument
for (Iterator i = info.attributes(); i != null && i.hasNext(); )
{
DTDAttributeTypeInfo attr = (DTDAttributeTypeInfo) i.next();
String value = attr.value;
if ("#IMPLIED".equals(attr.mode) && value == null)
continue;
DomAttr node = (DomAttr) createAttribute(attr.name);
String value = attr.value;
if (value == null)
{
value = "";

View File

@ -124,7 +124,7 @@ public class DomElement
node.attributes = new DomNamedNodeMap(node, Node.ATTRIBUTE_NODE);
for (DomNode ctx = attributes.first; ctx != null; ctx = ctx.next)
{
node.attributes.setNamedItemNS(ctx.cloneNode(true));
node.attributes.setNamedItem(ctx.cloneNode(true), true, true);
}
}
return node;

View File

@ -148,7 +148,7 @@ public class DomNamedNodeMap
*/
public Node setNamedItem(Node arg)
{
return setNamedItem(arg, false);
return setNamedItem(arg, false, false);
}
/**
@ -160,10 +160,10 @@ public class DomNamedNodeMap
*/
public Node setNamedItemNS(Node arg)
{
return setNamedItem(arg, true);
return setNamedItem(arg, true, false);
}
Node setNamedItem(Node arg, boolean ns)
Node setNamedItem(Node arg, boolean ns, boolean cloning)
{
if (readonly)
{
@ -171,7 +171,7 @@ public class DomNamedNodeMap
}
DomNode node = (DomNode) arg;
if (node.owner != owner.owner)
if (!cloning && node.owner != owner.owner)
{
throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR);
}

View File

@ -1108,26 +1108,47 @@ public abstract class DomNode
*/
public Node cloneNode(boolean deep)
{
DomNode node = (DomNode) clone();
if (deep)
{
DomDocument doc = (nodeType == DOCUMENT_NODE) ?
(DomDocument) node : node.owner;
boolean building = doc.building;
return cloneNodeDeepInternal(true, null);
}
DomNode node = (DomNode) clone();
if (nodeType == ENTITY_REFERENCE_NODE)
{
node.makeReadonly();
}
notifyUserDataHandlers(UserDataHandler.NODE_CLONED, this, node);
return node;
}
/**
* Returns a deep clone of this node.
*/
private DomNode cloneNodeDeepInternal(boolean root, DomDocument doc)
{
DomNode node = (DomNode) clone();
boolean building = false; // Never used unless root is true
if (root)
{
doc = (nodeType == DOCUMENT_NODE) ? (DomDocument) node : node.owner;
building = doc.building;
doc.building = true; // Permit certain structural rules
for (DomNode ctx = first; ctx != null; ctx = ctx.next)
{
DomNode newChild = (DomNode) ctx.cloneNode(deep);
newChild.setOwner(doc);
node.appendChild(newChild);
}
doc.building = building;
}
node.owner = doc;
for (DomNode ctx = first; ctx != null; ctx = ctx.next)
{
DomNode newChild = ctx.cloneNodeDeepInternal(false, doc);
node.appendChild(newChild);
}
if (nodeType == ENTITY_REFERENCE_NODE)
{
node.makeReadonly();
}
if (root)
{
doc.building = building;
}
notifyUserDataHandlers(UserDataHandler.NODE_CLONED, this, node);
return node;
}

View File

@ -138,6 +138,7 @@ public class SAXEventSink
doc = new DomDocument();
doc.setStrictErrorChecking(false);
doc.setBuilding(true);
doc.setDefaultAttributes(false);
ctx = doc;
final String FEATURES = "http://xml.org/sax/features/";
@ -185,6 +186,7 @@ public class SAXEventSink
{
doc.setStrictErrorChecking(true);
doc.setBuilding(false);
doc.setDefaultAttributes(true);
DomDoctype doctype = (DomDoctype) doc.getDoctype();
if (doctype != null)
{

View File

@ -4598,6 +4598,28 @@ public class XMLParser
}
return false;
}
public String toString()
{
StringBuffer buf = new StringBuffer(getClass().getName());
buf.append('[');
buf.append("name=");
buf.append(name);
if (value != null)
{
buf.append(",value=");
buf.append(value);
}
if (type != null)
{
buf.append(",type=");
buf.append(type);
}
if (specified)
buf.append(",specified");
buf.append(']');
return buf.toString();
}
}

Some files were not shown because too many files have changed in this diff Show More