Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

2
external/ikvm/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
reflect/bin
reflect/obj

37
external/ikvm/CommonAssemblyInfo.cs.in vendored Normal file
View File

@@ -0,0 +1,37 @@
/*
Copyright (C) 2008 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
*/
using System.Reflection;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jeroen Frijters")]
[assembly: AssemblyProduct("IKVM.NET")]
[assembly: AssemblyCopyright("Copyright (C) 2002-2013 Jeroen Frijters")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("7.3.@BUILD@.0")]
#if SIGNCODE
#pragma warning disable 1699
[assembly: AssemblyKeyName("ikvm-key")]
#endif

48
external/ikvm/HOWTO vendored Normal file
View File

@@ -0,0 +1,48 @@
IKVM.NET Build Instructions
---------------------------
This IKVM.NET source bundle requires OpenJDK 7u6 b24 sources (and build artifacts).
They can be downloaded from the SourceForge IKVM project, or from:
http://www.frijters.net/openjdk-7u6-b24-stripped.zip
This file should be unzipped in the same directory as where the ikvm directory
(that contains this unzipped source bundle) lives.
Download ICSharpCode.SharpZipLib.dll (from http://www.icsharpcode.net/opensource/sharpziplib/
or from the ikvmbin-x.y.z.r.zip in the SourceForge IKVM project) and copy it to ikvm/bin.
Add the bin directory of NAnt 0.85 and JDK 7 to the PATH. It is recommend to use the 64 bit
version of Java 7.
From the ikvm directory run "nant".
You now should have the built binaries in ikvm/bin. Note that this only builds the managed
binaries, to build the native binary see Native Build.
Native Build
------------
Windows:
Make sure you have Visual C++ 2008 installed. Open a Visual Studio 2008 Command Prompt.
From the ikvm directory run "nant native".
Linux:
Make sure you have gcc installed. From the ikvm directory run "nant native".
Additional Information
----------------------
IKVM.Runtime.dll and the various IKVM.OpenJDK.*.dll assemblies mutually depend on each other.
This is accomplished by building IKVM.Runtime.dll in two passes. The first pass defines the
methods and types that the IKVM.OpenJDK.*.dll assemblies use, but generally with an empty
method body (look for #if FIRST_PASS in the IKVM.Runtime.dll sources). The second pass is
built after the IKVM.OpenJDK.*.dll assemblies have been built.
The version number of the build is defined in ikvm/CommonAssemblyInfo.cs.in
If you want to do a strong named build, make sure you have a key container installed named
"ikvm-key" and run the build with "nant signed".

425
external/ikvm/LICENSE vendored Normal file
View File

@@ -0,0 +1,425 @@
IMPORTANT NOTICE
Copyright (C) 1998-2008 Free Software Foundation, Inc.
Copyright (C) 1996-2011 Oracle and/or its affiliates
Copyright (C) 2002-2011 Jeroen Frijters
Some files in this distribution are part of GNU Classpath or OpenJDK and
are licensed under the GNU General Public License (GPL) version 2
with "Classpath" exception. This applies in particular to:
- IKVM.OpenJDK.*.dll
- some of the *.java files (see each file header for license)
See http://www.gnu.org/software/classpath/ for information on the
GNU Classpath license and "Classpath" exception.
See below for a full copy of the GPL license and the Sun version of the
"Classpath" exception.
-----------------------------------------------------------------------------
Copyright (C) 2002-2011 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
-----------------------------------------------------------------------------
The GNU General Public License (GPL)
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share
and change it. By contrast, the GNU General Public License is intended to
guarantee your freedom to share and change free software--to make sure the
software is free for all its users. This General Public License applies to
most of the Free Software Foundation's software and to any other program whose
authors commit to using it. (Some other Free Software Foundation software is
covered by the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom to
distribute copies of free software (and charge for this service if you wish),
that you receive source code or can get it if you want it, that you can change
the software or use pieces of it in new free programs; and that you know you
can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny
you these rights or to ask you to surrender the rights. These restrictions
translate to certain responsibilities for you if you distribute copies of the
software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for
a fee, you must give the recipients all the rights that you have. You must
make sure that they, too, receive or can get the source code. And you must
show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If the
software is modified by someone else and passed on, we want its recipients to
know that what they have is not the original, so that any problems introduced
by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that redistributors of a free program will
individually obtain patent licenses, in effect making the program proprietary.
To prevent this, we have made it clear that any patent must be licensed for
everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms of
this General Public License. The "Program", below, refers to any such program
or work, and a "work based on the Program" means either the Program or any
derivative work under copyright law: that is to say, a work containing the
Program or a portion of it, either verbatim or with modifications and/or
translated into another language. (Hereinafter, translation is included
without limitation in the term "modification".) Each licensee is addressed as
"you".
Activities other than copying, distribution and modification are not covered by
this License; they are outside its scope. The act of running the Program is
not restricted, and the output from the Program is covered only if its contents
constitute a work based on the Program (independent of having been made by
running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as
you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this License
and to the absence of any warranty; and give any other recipients of the
Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may
at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus
forming a work based on the Program, and copy and distribute such modifications
or work under the terms of Section 1 above, provided that you also meet all of
these conditions:
a) You must cause the modified files to carry prominent notices stating
that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or
in part contains or is derived from the Program or any part thereof, to be
licensed as a whole at no charge to all third parties under the terms of
this License.
c) If the modified program normally reads commands interactively when run,
you must cause it, when started running for such interactive use in the
most ordinary way, to print or display an announcement including an
appropriate copyright notice and a notice that there is no warranty (or
else, saying that you provide a warranty) and that users may redistribute
the program under these conditions, and telling the user how to view a copy
of this License. (Exception: if the Program itself is interactive but does
not normally print such an announcement, your work based on the Program is
not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be reasonably
considered independent and separate works in themselves, then this License, and
its terms, do not apply to those sections when you distribute them as separate
works. But when you distribute the same sections as part of a whole which is a
work based on the Program, the distribution of the whole must be on the terms
of this License, whose permissions for other licensees extend to the entire
whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise the
right to control the distribution of derivative or collective works based on
the Program.
In addition, mere aggregation of another work not based on the Program with the
Program (or with a work based on the Program) on a volume of a storage or
distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under
Section 2) in object code or executable form under the terms of Sections 1 and
2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source
code, which must be distributed under the terms of Sections 1 and 2 above
on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to
give any third party, for a charge no more than your cost of physically
performing source distribution, a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of Sections 1
and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to
distribute corresponding source code. (This alternative is allowed only
for noncommercial distribution and only if you received the program in
object code or executable form with such an offer, in accord with
Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all
the source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and installation
of the executable. However, as a special exception, the source code
distributed need not include anything that is normally distributed (in either
source or binary form) with the major components (compiler, kernel, and so on)
of the operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the source
code from the same place counts as distribution of the source code, even though
third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as
expressly provided under this License. Any attempt otherwise to copy, modify,
sublicense or distribute the Program is void, and will automatically terminate
your rights under this License. However, parties who have received copies, or
rights, from you under this License will not have their licenses terminated so
long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it.
However, nothing else grants you permission to modify or distribute the Program
or its derivative works. These actions are prohibited by law if you do not
accept this License. Therefore, by modifying or distributing the Program (or
any work based on the Program), you indicate your acceptance of this License to
do so, and all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program),
the recipient automatically receives a license from the original licensor to
copy, distribute or modify the Program subject to these terms and conditions.
You may not impose any further restrictions on the recipients' exercise of the
rights granted herein. You are not responsible for enforcing compliance by
third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues), conditions
are imposed on you (whether by court order, agreement or otherwise) that
contradict the conditions of this License, they do not excuse you from the
conditions of this License. If you cannot distribute so as to satisfy
simultaneously your obligations under this License and any other pertinent
obligations, then as a consequence you may not distribute the Program at all.
For example, if a patent license would not permit royalty-free redistribution
of the Program by all those who receive copies directly or indirectly through
you, then the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and
the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or
other property right claims or to contest validity of any such claims; this
section has the sole purpose of protecting the integrity of the free software
distribution system, which is implemented by public license practices. Many
people have made generous contributions to the wide range of software
distributed through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing to
distribute software through any other system and a licensee cannot impose that
choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original
copyright holder who places the Program under this License may add an explicit
geographical distribution limitation excluding those countries, so that
distribution is permitted only in or among countries not thus excluded. In
such case, this License incorporates the limitation as if written in the body
of this License.
9. The Free Software Foundation may publish revised and/or new versions of the
General Public License from time to time. Such new versions will be similar in
spirit to the present version, but may differ in detail to address new problems
or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any later
version", you have the option of following the terms and conditions either of
that version or of any later version published by the Free Software Foundation.
If the Program does not specify a version number of this License, you may
choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software Foundation,
write to the Free Software Foundation; we sometimes make exceptions for this.
Our decision will be guided by the two goals of preserving the free status of
all derivatives of our free software and of promoting the sharing and reuse of
software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach
them to the start of each source file to most effectively convey the exclusion
of warranty; and each file should have at least the "copyright" line and a
pointer to where the full notice is found.
One line to give the program's name and a brief idea of what it does.
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it
starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free
software, and you are welcome to redistribute it under certain conditions;
type 'show c' for details.
The hypothetical commands 'show w' and 'show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may be
called something other than 'show w' and 'show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school,
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
'Gnomovision' (which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General Public
License instead of this License.
"CLASSPATH" EXCEPTION TO THE GPL
Certain source files distributed by Oracle America and/or its affiliates are
subject to the following clarification and special exception to the GPL, but
only where Oracle has expressly included in the particular source file's header
the words "Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the LICENSE file that accompanied this code."
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.
-----------------------------------------------------------------------------
-------------------------------------------------------------------------
$Id$
-------------------------------------------------------------------------
Copyright (c) 1999 Visual Numerics Inc. All Rights Reserved.
Permission to use, copy, modify, and distribute this software is freely
granted by Visual Numerics, Inc., provided that the copyright notice
above and the following warranty disclaimer are preserved in human
readable form.
Because this software is licenses free of charge, it is provided
"AS IS", with NO WARRANTY. TO THE EXTENT PERMITTED BY LAW, VNI
DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO ITS PERFORMANCE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
VNI WILL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER ARISING OUT OF THE USE
OF OR INABILITY TO USE THIS SOFTWARE, INCLUDING BUT NOT LIMITED TO DIRECT,
INDIRECT, SPECIAL, CONSEQUENTIAL, PUNITIVE, AND EXEMPLARY DAMAGES, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
This Java code is based on C code in the package fdlibm,
which can be obtained from www.netlib.org.
The original fdlibm C code contains the following notice.
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Developed at SunSoft, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.
-----------------------------------------------------------------------------

27
external/ikvm/THANKYOU vendored Normal file
View File

@@ -0,0 +1,27 @@
The following people have made contributions (in any way shape or form) to the IKVM.NET project.
Eyal Alaluf
Stuart Ballard
Volker Berlin
Miguel Alfredo Garcia Gutierrez
Kevin Grigorenko
Brian Heineman
Miguel de Icaza
Michael Kay
Chris Laffra
Nat Luengnaruemitchai
Alan Macek
Andy Malakov
M. David Peterson
Jonathan Pierce
KiYun Roe
Stephen Schaub
Jo Shields
Brian Sletten
Albert Strasheim
Dennis Ushakov
Zoltan Varga
Dawid Weiss
Mark Wielaard
And, of course, all GNU Classpath, OpenJDK and Mono developers.

View File

@@ -0,0 +1 @@
ee5463a922ef0934281707d1b22ffa655da35ffa

41
external/ikvm/TRADEMARK vendored Normal file
View File

@@ -0,0 +1,41 @@
OpenJDK Trademark Notice
Version 1.1, 2008/3/10
OpenJDK (the "Name") is a trademark of Sun Microsystems, Inc. (the "Owner").
Owner permits any person obtaining a copy of this software (the "Software")
which is based on original software retrieved from one of the following
websites: http://download.java.net/openjdk, http://hg.openjdk.java.net/jdk6,
or http://openjdk.java.net (each a "Website", with the original software made
available by the Owner on a Website being known as the "Website Software") to
use the Name in package names and version strings of the Software subject to
the following conditions:
- The Software is a substantially complete implementation of the OpenJDK
development kit or runtime environment code made available by Owner on a
Website, and the vast majority of the Software code is identical to the
upstream Website Software;
- No permission is hereby granted to use the Name in any other manner,
unless such use constitutes "fair use."
- The Owner makes no warranties of any kind respecting the Name and all
representations and warranties, including any implied warranty of
merchantability, fitness for a particular purpose or non-infringement
are hereby disclaimed; and
- This notice and the following legend are included in all copies of the
Software or portions of it:
OpenJDK is a trademark or registered trademark of Sun Microsystems,
Inc. in the United States and other countries.
The Name may also be used in connection with descriptions of the Software that
constitute "fair use," such as "derived from the OpenJDK code base" or "based
on the OpenJDK source code."
Owner intends to revise this Notice as necessary in order to meet the needs of
the OpenJDK Community. Please send questions or comments about this Notice to
Sun Microsystems at openjdk-tm@sun.com. Revisions to this Notice will be
announced on the public mailing list announce@openjdk.java.net, to which you
may subscribe by visiting http://mail.openjdk.java.net. The latest version of
this Notice may be found at http://openjdk.java.net/legal.

41
external/ikvm/awt/AssemblyInfo.cs.in vendored Normal file
View File

@@ -0,0 +1,41 @@
/*
Copyright (C) 2002-2010 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
*/
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("IKVM.NET AWT Support")]
[assembly: AssemblyDescription("Winforms peers and 'native' code")]
[assembly: System.Security.AllowPartiallyTrustedCallers]
#if SIGNCODE
[assembly: InternalsVisibleTo("IKVM.OpenJDK.SwingAWT, PublicKey=@PUBLICKEY@")]
#else
[assembly: InternalsVisibleTo("IKVM.OpenJDK.SwingAWT")]
#endif

View File

@@ -0,0 +1,161 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E00A0FA2-1FD7-4DD9-8C06-7202CE366102}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>IKVM.AWT.WinForms</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace>awt</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE;DEBUG;WHIDBEY</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>672,612</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="IKVM.OpenJDK.Core, Version=0.39.3280.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\IKVM.OpenJDK.Core.dll</HintPath>
</Reference>
<Reference Include="IKVM.OpenJDK.Media, Version=0.41.3440.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\IKVM.OpenJDK.Media.dll</HintPath>
</Reference>
<Reference Include="IKVM.OpenJDK.Misc, Version=0.39.3280.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\IKVM.OpenJDK.Misc.dll</HintPath>
</Reference>
<Reference Include="IKVM.OpenJDK.SwingAWT, Version=0.39.3280.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\IKVM.OpenJDK.SwingAWT.dll</HintPath>
</Reference>
<Reference Include="IKVM.OpenJDK.Text, Version=0.39.3280.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\bin\IKVM.OpenJDK.Text.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
</Reference>
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\CommonAssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="composite.cs" />
<Compile Include="converter.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="fonts-0.95.cs" />
<Compile Include="graphics.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="IconFactory.cs" />
<Compile Include="images.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="native.cs" />
<Compile Include="printing.cs" />
<Compile Include="robot.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ShellApi.cs" />
<Compile Include="theming.cs" />
<Compile Include="toolkit-0.95.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\runtime\IKVM.Runtime.8.csproj">
<Project>{F5C7B588-0403-4AF2-A4DE-5697DE21BC2C}</Project>
<Name>IKVM.Runtime.8</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

683
external/ikvm/awt/IconFactory.cs vendored Normal file

File diff suppressed because it is too large Load Diff

562
external/ikvm/awt/ShellApi.cs vendored Normal file

File diff suppressed because it is too large Load Diff

72
external/ikvm/awt/awt.build vendored Normal file
View File

@@ -0,0 +1,72 @@
<?xml version="1.0"?>
<project name="awt" default="awt">
<include buildfile="../ikvm.include" />
<target name="AssemblyInfo.cs">
<loadfile file="../tools/pubkey.txt" property="publickey" />
<copy file="AssemblyInfo.cs.in" tofile="AssemblyInfo.cs" overwrite="true">
<filterchain>
<replacetokens>
<token key="PUBLICKEY" value="${publickey}" />
</replacetokens>
</filterchain>
</copy>
</target>
<target name="first-pass" depends="AssemblyInfo.cs">
<property overwrite="false" name="signed" value="" />
<csc target="library" output="../bin/IKVM.AWT.WinForms.dll" define="FIRST_PASS;${signed}" rebuild="true" nostdlib="true" noconfig="true">
<sources>
<include name="../CommonAssemblyInfo.cs" />
<include name="AssemblyInfo.cs" />
<include name="native.cs" />
<include name="ShellApi.cs" />
<include name="theming.cs" />
</sources>
<references>
<include name="${ReferencePath}/mscorlib.dll" asis="true" />
<include name="${ReferencePath}/System.dll" asis="true" />
<include name="${ReferencePath}/System.Windows.Forms.dll" asis="true" />
<include name="${ReferencePath}/System.Drawing.dll" asis="true" />
</references>
</csc>
</target>
<target name="awt" depends="AssemblyInfo.cs">
<property overwrite="false" name="signed" value="" />
<csc target="library" output="../bin/IKVM.AWT.WinForms.dll" define="TRACE;${signed}" rebuild="true" nostdlib="true" noconfig="true">
<sources>
<include name="../CommonAssemblyInfo.cs" />
<include name="AssemblyInfo.cs" />
<include name="converter.cs" />
<include name="fonts-0.95.cs" />
<include name="graphics.cs" />
<include name="composite.cs" />
<include name="IconFactory.cs" />
<include name="images.cs" />
<include name="native.cs" />
<include name="printing.cs" />
<include name="robot.cs" />
<include name="toolkit-0.95.cs" />
<include name="ShellApi.cs" />
<include name="theming.cs" />
</sources>
<references>
<include name="../bin/IKVM.OpenJDK.Core.dll" asis="true" />
<include name="../bin/IKVM.OpenJDK.Text.dll" asis="true" />
<include name="../bin/IKVM.OpenJDK.SwingAWT.dll" asis="true" />
<include name="../bin/IKVM.OpenJDK.Media.dll" asis="true" />
<include name="../bin/IKVM.OpenJDK.Misc.dll" asis="true" />
<include name="../bin/IKVM.Runtime.dll" asis="true" />
<include name="${ReferencePath}/mscorlib.dll" asis="true" />
<include name="${ReferencePath}/System.dll" asis="true" />
<include name="${ReferencePath}/System.Windows.Forms.dll" asis="true" />
<include name="${ReferencePath}/System.Drawing.dll" asis="true" />
</references>
<nowarn>
<!-- disable warnings about obsolete members (because the peer API has lots of those) -->
<warning number="612" />
</nowarn>
</csc>
<if test="${property::exists('peverify')}">
<exec program="${peverify}" commandline="-nologo ../bin/IKVM.AWT.WinForms.dll" />
</if>
</target>
</project>

143
external/ikvm/awt/composite.cs vendored Normal file
View File

@@ -0,0 +1,143 @@
/*
Copyright (C) 2010 Volker Berlin (i-net software)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace ikvm.awt {
internal class CompositeHelper {
private readonly ImageAttributes imageAttributes = new ImageAttributes();
/// <summary>
/// Create a default CompositeHelper. Is used from Create only.
/// </summary>
protected CompositeHelper() {
}
internal static CompositeHelper Create(java.awt.Composite comp, Graphics graphics){
if (comp is java.awt.AlphaComposite) {
java.awt.AlphaComposite alphaComp = (java.awt.AlphaComposite)comp;
float alpha = alphaComp.getAlpha();
switch (alphaComp.getRule()) {
case java.awt.AlphaComposite.CLEAR:
graphics.CompositingMode = CompositingMode.SourceCopy;
return new ClearCompositeHelper();
case java.awt.AlphaComposite.SRC:
graphics.CompositingMode = CompositingMode.SourceCopy;
break;
case java.awt.AlphaComposite.SRC_OVER:
graphics.CompositingMode = CompositingMode.SourceOver;
break;
case java.awt.AlphaComposite.DST:
graphics.CompositingMode = CompositingMode.SourceOver;
alpha = 0.0F;
break;
default:
graphics.CompositingMode = CompositingMode.SourceOver;
Console.Error.WriteLine("AlphaComposite with Rule " + alphaComp.getRule() + " not supported.");
break;
}
if (alpha == 1.0) {
return new CompositeHelper();
} else {
return new AlphaCompositeHelper(alpha);
}
} else {
graphics.CompositingMode = CompositingMode.SourceOver;
Console.Error.WriteLine("Composite not supported: " + comp.GetType().FullName);
return new CompositeHelper();
}
}
internal virtual int GetArgb(java.awt.Color color) {
return color.getRGB();
}
internal virtual Color GetColor( java.awt.Color color ){
return color == null ? Color.Empty : Color.FromArgb(GetArgb(color));
}
internal virtual int ToArgb(Color color) {
return color.ToArgb();
}
internal virtual java.awt.Color GetColor(Color color) {
return color == Color.Empty ? null : new java.awt.Color(ToArgb(color), true);
}
/// <summary>
/// Get the ImageAttributes instance. Does not change it bcause it is not a copy.
/// </summary>
/// <returns></returns>
internal virtual ImageAttributes GetImageAttributes(){
return imageAttributes;
}
}
internal sealed class AlphaCompositeHelper : CompositeHelper {
private readonly float alpha;
/// <summary>
/// Create a AlphaCompositeHelper
/// </summary>
/// <param name="alpha">a value in the range from 0.0 to 1.0</param>
internal AlphaCompositeHelper(float alpha) {
this.alpha = alpha;
ColorMatrix matrix = new ColorMatrix();
matrix.Matrix33 = alpha;
GetImageAttributes().SetColorMatrix(matrix);
}
internal override int GetArgb(java.awt.Color color) {
uint argb = (uint)color.getRGB();
uint newAlpha = (uint)((0xff000000 & argb) * alpha + 0x800000);
uint newArgb = (0xff000000 & newAlpha) | (0xffffff & argb);
return (int)newArgb;
}
internal override int ToArgb(Color color) {
uint argb = (uint)color.ToArgb();
uint newAlpha = (uint)((0xff000000 & argb) / alpha + 0x800000);
uint newArgb = (0xff000000 & newAlpha) | (0xffffff & argb);
return (int)newArgb;
}
}
internal sealed class ClearCompositeHelper : CompositeHelper {
internal ClearCompositeHelper()
{
ColorMatrix matrix = new ColorMatrix();
matrix.Matrix00 = matrix.Matrix11 = matrix.Matrix22 = matrix.Matrix33 = 0.0F;
GetImageAttributes().SetColorMatrix(matrix);
}
internal override int GetArgb(java.awt.Color color) {
return 0;
}
}
}

402
external/ikvm/awt/converter.cs vendored Normal file
View File

@@ -0,0 +1,402 @@
/*
Copyright (C) 2002, 2004, 2005, 2006, 2007 Jeroen Frijters
Copyright (C) 2006 Active Endpoints, Inc.
Copyright (C) 2006 - 2010 Volker Berlin (i-net software)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using System.ComponentModel;
using System.Reflection;
using System.Text;
using java.awt.datatransfer;
using java.awt.image;
using java.awt.peer;
using java.net;
using java.util;
namespace ikvm.awt
{
/// <summary>
/// This class has some static convertion methods from Java to C# objects
/// </summary>
class J2C
{
internal static Color ConvertColor(java.awt.Color color)
{
return color == null ? Color.Empty : Color.FromArgb(color.getRGB());
}
internal static Bitmap ConvertImage(java.awt.Image img)
{
if (img is BufferedImage)
{
return ((BufferedImage)img).getBitmap();
}
if (img is NetVolatileImage)
{
return ((NetVolatileImage)img).bitmap;
}
if (img is sun.awt.image.ToolkitImage)
{
sun.awt.image.ImageRepresentation ir = ((sun.awt.image.ToolkitImage)img).getImageRep();
// start the production and wait if not produce the image
lock( ir ) {
ir.prepare(null);
while ( ir.getBufferedImage() == null ) {
ir.wait();
}
}
return ir.getBufferedImage().getBitmap();
}
if (img is NoImage)
{
return null;
}
Console.WriteLine(new System.Diagnostics.StackTrace());
throw new NotImplementedException("Image class:" + img.GetType().FullName);
}
internal static PointF ConvertPoint(java.awt.geom.Point2D point)
{
return new PointF((float)point.getX(), (float)point.getY());
}
internal static RectangleF ConvertRect(java.awt.geom.Rectangle2D rect)
{
return new RectangleF((float)rect.getX(), (float)rect.getY(), (float)rect.getWidth(), (float)rect.getHeight());
}
internal static Rectangle ConvertRect(java.awt.Rectangle rect)
{
return new Rectangle(rect.x, rect.y, rect.width, rect.height);
}
/// <summary>
/// Create a rounded rectangle using lines and arcs
/// </summary>
/// <param name="x">upper left x coordinate</param>
/// <param name="y">upper left y coordinate</param>
/// <param name="w">width</param>
/// <param name="h">height</param>
/// <param name="arcWidth">the horizontal diameter of the arc at the four corners</param>
/// <param name="arcHeight">the vertical diameter of the arc at the four corners</param>
/// <returns></returns>
internal static GraphicsPath ConvertRoundRect(int x, int y, int w, int h, int arcWidth, int arcHeight)
{
GraphicsPath gp = new GraphicsPath();
bool drawArc = arcWidth > 0 && arcHeight > 0;
int a = arcWidth / 2;
int b = arcHeight / 2;
gp.AddLine(x + a, y, x + w - a, y);
if (drawArc)
{
gp.AddArc(x + w - arcWidth, y, arcWidth, arcHeight, 270, 90); //upper right arc
}
gp.AddLine(x + w, y + b, x + w, y + h - b);
if (drawArc)
{
gp.AddArc(x + w - arcWidth, y + h - arcHeight, arcWidth, arcHeight, 0, 90); //lower right arc
}
gp.AddLine(x + w - a, y + h, x + a, y + h);
if (drawArc)
{
gp.AddArc(x, y + h - arcHeight, arcWidth, arcHeight, 90, 90);//lower left arc
}
gp.AddLine(x, y + h - b, x, y + b);
if (drawArc)
{
gp.AddArc(x, y, arcWidth, arcHeight, 180, 90); //upper left arc
}
gp.CloseFigure();
return gp;
}
internal static GraphicsPath ConvertShape(java.awt.Shape shape)
{
java.awt.geom.PathIterator iterator = shape.getPathIterator(null);
GraphicsPath gp = new GraphicsPath();
gp.FillMode = (FillMode)iterator.getWindingRule();
float[] coords = new float[6];
float x = 0;
float y = 0;
while (!iterator.isDone())
{
int type = iterator.currentSegment(coords);
switch (type)
{
case java.awt.geom.PathIterator.__Fields.SEG_MOVETO:
x = coords[0];
y = coords[1];
gp.StartFigure();
break;
case java.awt.geom.PathIterator.__Fields.SEG_LINETO:
gp.AddLine(x, y, coords[0], coords[1]);
x = coords[0];
y = coords[1];
break;
case java.awt.geom.PathIterator.__Fields.SEG_QUADTO:
gp.AddBezier(x, y, coords[0], coords[1], coords[0], coords[1], coords[2], coords[3]);
x = coords[2];
y = coords[3];
break;
case java.awt.geom.PathIterator.__Fields.SEG_CUBICTO:
gp.AddBezier(x, y, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
x = coords[4];
y = coords[5];
break;
case java.awt.geom.PathIterator.__Fields.SEG_CLOSE:
gp.CloseFigure();
break;
}
iterator.next();
}
return gp;
}
internal static LineJoin ConvertLineJoin(int join)
{
switch (join)
{
case java.awt.BasicStroke.JOIN_MITER:
return LineJoin.Miter;
case java.awt.BasicStroke.JOIN_ROUND:
return LineJoin.Round;
case java.awt.BasicStroke.JOIN_BEVEL:
return LineJoin.Bevel;
default:
Console.WriteLine("Unknown line join type:" + join);
return LineJoin.Miter;
}
}
internal static Matrix ConvertTransform(java.awt.geom.AffineTransform tx)
{
return new Matrix(
(float)tx.getScaleX(),
(float)tx.getShearY(),
(float)tx.getShearX(),
(float)tx.getScaleY(),
(float)tx.getTranslateX(),
(float)tx.getTranslateY());
}
internal static FontFamily CreateFontFamily(String name)
{
String name2 = name == null ? null : name.ToLower();
switch (name2)
{
case "monospaced":
case "courier":
return FontFamily.GenericMonospace;
case "serif":
return FontFamily.GenericSerif;
case "sansserif":
case "dialog":
case "dialoginput":
case null:
case "default":
return FontFamily.GenericSansSerif;
default:
try
{
return new FontFamily(name);
}
catch (ArgumentException)
{
return FontFamily.GenericSansSerif;
}
}
}
private static FontStyle ConvertFontStyle(int style)
{
FontStyle fs = FontStyle.Regular;
if ((style & java.awt.Font.BOLD) != 0)
{
fs |= FontStyle.Bold;
}
if ((style & java.awt.Font.ITALIC) != 0)
{
fs |= FontStyle.Italic;
}
return fs;
}
internal static Font ConvertFont(String name, int style, float size)
{
if (size <= 0)
{
size = 1;
}
FontFamily family = CreateFontFamily(name);
FontStyle fontStyle = ConvertFontStyle(style);
if (!family.IsStyleAvailable(fontStyle))
{
//Some Fonts (for example Aharoni) does not support Regular style. This throw an exception else it is not documented.
if(family.IsStyleAvailable(FontStyle.Regular)){
fontStyle = FontStyle.Regular;
}else
if(family.IsStyleAvailable(FontStyle.Bold)){
fontStyle = FontStyle.Bold;
}else
if(family.IsStyleAvailable(FontStyle.Italic)){
fontStyle = FontStyle.Italic;
}else
if(family.IsStyleAvailable(FontStyle.Bold | FontStyle.Italic)){
fontStyle = FontStyle.Bold | FontStyle.Italic;
}
}
return new Font(family, size, fontStyle, GraphicsUnit.Pixel);
}
internal static Region ConvertRegion(sun.java2d.pipe.Region shape)
{
if (shape == null)
{
return null;
}
if (shape.isRectangular())
{
int x = shape.getLoX();
int y = shape.getLoY();
int w = shape.getHiX() - x;
int h = shape.getHiY() - y;
if (w < 0 || h < 0)
{
return new Region();
}
else
{
return new Region(new Rectangle(x, y, w, h));
}
}
else
{
using (GraphicsPath path = new GraphicsPath())
{
sun.java2d.pipe.SpanIterator iter = shape.getSpanIterator();
int[] box = new int[4];
while (iter.nextSpan(box))
{
path.AddRectangle(new Rectangle(box[0], box[1], box[2] - box[0], box[3] - box[1]));
}
return new Region(path);
}
}
}
internal static string ConvertGlyphVector(java.awt.font.GlyphVector gv) {
int count = gv.getNumGlyphs();
char[] text = new char[count];
for (int i = 0; i < count; i++) {
text[i] = (char)gv.getGlyphCode(i);
}
return new string(text);
}
}
/// <summary>
/// This class has some static convertion function from C# to Java objects
/// </summary>
class C2J
{
internal static java.awt.geom.AffineTransform ConvertMatrix(Matrix matrix)
{
float[] elements = matrix.Elements;
return new java.awt.geom.AffineTransform(elements);
}
internal static java.awt.Rectangle ConvertRectangle(RectangleF rec)
{
return new java.awt.Rectangle((int)rec.X, (int)rec.Y, (int)rec.Width, (int)rec.Height);
}
internal static java.awt.Color ConvertColor(Color color)
{
return color == Color.Empty ? null : new java.awt.Color(color.ToArgb(),true);
}
internal static java.awt.Font ConvertFont(Font font)
{
float size = font.Size;
if (font.Unit != GraphicsUnit.Pixel)
{
size = font.SizeInPoints * java.awt.Toolkit.getDefaultToolkit().getScreenResolution() / 72;
}
java.awt.Font jFont = new java.awt.Font(font.Name, (int)font.Style, (int)size);
if (jFont.getSize2D() != size)
{
jFont = jFont.deriveFont(size);
}
//TODO performance we should set the .NET Font, we can do it with an aditional constructor.
return jFont;
}
internal static java.awt.Shape ConvertShape(GraphicsPath path) {
java.awt.geom.GeneralPath shape = new java.awt.geom.GeneralPath();
shape.setWindingRule((int)path.FillMode);
for (int i = 0; i < path.PointCount; i++) {
byte pathType = path.PathTypes[i];
int type = pathType & 0x07;
PointF point = path.PathPoints[i];
switch (type) {
case 0:
// Indicates that the point is the start of a figure.
shape.moveTo(point.X, point.Y);
break;
case 1:
// Indicates that the point is one of the two endpoints of a line.
shape.lineTo(point.X, point.Y);
break;
case 3:
// Indicates that the point is an endpoint or control point of a cubic B<>zier spline.
PointF point2 = path.PathPoints[++i];
PointF point3 = path.PathPoints[++i];
shape.curveTo(point.X, point.Y, point2.X, point2.Y, point3.X, point3.Y);
pathType = path.PathTypes[i];
break;
default:
Console.WriteLine("Unknown GraphicsPath type: " + type);
break;
}
if ((pathType & 0x80) > 0) {
// Specifies that the point is the last point in a closed subpath (figure).
shape.closePath();
}
}
return shape;
}
}
}

557
external/ikvm/awt/fonts-0.95.cs vendored Normal file

File diff suppressed because it is too large Load Diff

2226
external/ikvm/awt/graphics.cs vendored Normal file

File diff suppressed because it is too large Load Diff

211
external/ikvm/awt/images.cs vendored Normal file
View File

@@ -0,0 +1,211 @@
/*
Copyright (C) 2002, 2004, 2005, 2006 Jeroen Frijters
Copyright (C) 2006 Active Endpoints, Inc.
Copyright (C) 2006 - 2013 Volker Berlin (i-net software)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
*/
using System;
using System.Drawing;
using java.awt.image;
using java.util;
using System.Drawing.Imaging;
namespace ikvm.awt
{
class NetVolatileImage : java.awt.image.VolatileImage
{
internal readonly Bitmap bitmap;
internal readonly java.awt.Component component;
private java.awt.Font defaultFont;
private readonly int width;
private readonly int height;
internal NetVolatileImage(java.awt.Component component, int width, int height)
{
this.component = component;
bitmap = new Bitmap(width, height);
this.width = width;
this.height = height;
using (Graphics g = Graphics.FromImage(bitmap))
{
g.Clear(Color.White);
}
}
internal NetVolatileImage(int width, int height) : this(null, width, height)
{
}
public override bool contentsLost()
{
return false;
}
private java.awt.Color getForeground()
{
if (component != null)
{
return component.getForeground();
}
else
{
return java.awt.Color.black;
}
}
private java.awt.Color getBackground()
{
if (component != null)
{
return component.getBackground();
}
else
{
return java.awt.Color.white;
}
}
private java.awt.Font getFont()
{
if (component != null)
{
return component.getFont();
}
else
{
if (defaultFont == null)
{
defaultFont = new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12);
}
return defaultFont;
}
}
public override int getHeight(ImageObserver io)
{
return height; // bitmap.Height --> need invoke or lock
}
public override int getWidth(ImageObserver io)
{
return width; // bitmap.Width --> need invoke or lock
}
public override object getProperty(string str, ImageObserver io)
{
throw new NotImplementedException();
}
public override java.awt.Graphics2D createGraphics()
{
//Graphics g = Graphics.FromImage(bitmap);
// HACK for off-screen images we don't want ClearType or anti-aliasing
// TODO I'm sure Java 2D has a way to control text rendering quality, we should honor that
//g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;
return new BitmapGraphics(bitmap, getFont(), J2C.ConvertColor(getForeground()), J2C.ConvertColor(getBackground()));
}
public override int getHeight()
{
return height; // bitmap.Height --> need invoke or lock
}
public override int getWidth()
{
return width; // bitmap.Width --> need invoke or lock
}
public override BufferedImage getSnapshot()
{
return new BufferedImage(bitmap);
}
public override int validate(java.awt.GraphicsConfiguration gc)
{
return 0;
}
public override java.awt.ImageCapabilities getCapabilities()
{
throw new NotImplementedException();
}
public override void flush()
{
}
}
class NoImage : java.awt.Image
{
private sun.awt.image.InputStreamImageSource source;
internal NoImage(sun.awt.image.InputStreamImageSource source) {
this.source = source;
}
public override int getWidth(java.awt.image.ImageObserver observer)
{
if (observer != null)
{
observer.imageUpdate(this, java.awt.image.ImageObserver.__Fields.ERROR | java.awt.image.ImageObserver.__Fields.ABORT, 0, 0, -1, -1);
}
return -1;
}
public override int getHeight(java.awt.image.ImageObserver observer)
{
if (observer != null)
{
observer.imageUpdate(this, java.awt.image.ImageObserver.__Fields.ERROR | java.awt.image.ImageObserver.__Fields.ABORT, 0, 0, -1, -1);
}
return -1;
}
public override ImageProducer getSource()
{
return source;
}
public override java.awt.Graphics getGraphics()
{
// TODO throw java.lang.IllegalAccessError: getGraphics() only valid for images created with createImage(w, h)
return null;
}
public override object getProperty(string name, java.awt.image.ImageObserver observer)
{
if (observer != null)
{
observer.imageUpdate(this, java.awt.image.ImageObserver.__Fields.ERROR | java.awt.image.ImageObserver.__Fields.ABORT, 0, 0, -1, -1);
}
return null;
}
public override void flush()
{
}
}
}

1038
external/ikvm/awt/native.cs vendored Normal file

File diff suppressed because it is too large Load Diff

335
external/ikvm/awt/printing.cs vendored Normal file
View File

@@ -0,0 +1,335 @@
/*
Copyright (C) 2009 Volker Berlin (i-net software)
Copyright (C) 2010 Karsten Heinrich (i-net software)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
*/
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
using System.Drawing.Printing;
namespace ikvm.awt.printing
{
/// <summary>
/// Base Implementation of the PrintPeer
/// </summary>
abstract class BasePrintPeer : sun.print.PrintPeer
{
public virtual Object getPrinterStatus(String PrinterName, java.lang.Class category)
{
return null;
}
public String getDefaultPrinterName()
{
return new PrinterSettings().PrinterName;
}
public String[] getAllPrinterNames()
{
PrinterSettings.StringCollection printers = PrinterSettings.InstalledPrinters;
String[] result = new String[printers.Count];
printers.CopyTo(result, 0);
return result;
}
public java.awt.Graphics2D createGraphics(System.Drawing.Graphics g)
{
return new PrintGraphics(g);
}
}
/// <summary>
/// Implementation of the PrintPeer for Linux
/// </summary>
class LinuxPrintPeer : BasePrintPeer
{
}
/// <summary>
/// Implementation of the PrintPeer for Windows
/// </summary>
class Win32PrintPeer : BasePrintPeer
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
private struct PRINTER_INFO_2
{
[MarshalAs(UnmanagedType.LPTStr)]
public string pServerName;
[MarshalAs(UnmanagedType.LPTStr)]
public string pPrinterName;
[MarshalAs(UnmanagedType.LPTStr)]
public string pShareName;
[MarshalAs(UnmanagedType.LPTStr)]
public string pPortName;
[MarshalAs(UnmanagedType.LPTStr)]
public string pDriverName;
[MarshalAs(UnmanagedType.LPTStr)]
public string pComment;
[MarshalAs(UnmanagedType.LPTStr)]
public string pLocation;
public IntPtr pDevMode;
[MarshalAs(UnmanagedType.LPTStr)]
public string pSepFile;
[MarshalAs(UnmanagedType.LPTStr)]
public string pPrintProcessor;
[MarshalAs(UnmanagedType.LPTStr)]
public string pDatatype;
[MarshalAs(UnmanagedType.LPTStr)]
public string pParameters;
public IntPtr pSecurityDescriptor;
public uint Attributes;
public uint Priority;
public uint DefaultPriority;
public uint StartTime;
public uint UntilTime;
public int Status;
public int cJobs;
public uint AveragePPM;
}
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool GetPrinter(SafePrinterHandle hPrinter, int dwLevel, IntPtr pPrinter, int cbBuf, out int pcbNeeded);
[DllImport("winspool.drv", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool OpenPrinter(string pPrinterName, out SafePrinterHandle hPrinter, IntPtr pDefault);
private const int ERROR_INSUFFICIENT_BUFFER = 122;
private const int PRINTER_STATUS_PAUSED = 0x1;
private const int PRINTER_STATUS_ERROR = 0x2; // MSDN says that this value is not used
private const int PRINTER_STATUS_PENDING_DELETION = 0x4;
private const int PRINTER_STATUS_PAPER_JAM = 0x8;
private const int PRINTER_STATUS_PAPER_OUT = 0x10;
private const int PRINTER_STATUS_MANUAL_FEED = 0x20;
private const int PRINTER_STATUS_PAPER_PROBLEM = 0x40;
private const int PRINTER_STATUS_OFFLINE = 0x80;
private const int PRINTER_STATUS_IO_ACTIVE = 0x100;
private const int PRINTER_STATUS_BUSY = 0x200;
private const int PRINTER_STATUS_PRINTING = 0x400;
private const int PRINTER_STATUS_OUTPUT_BIN_FULL = 0x800;
private const int PRINTER_STATUS_NOT_AVAILABLE = 0x1000;
private const int PRINTER_STATUS_WAITING = 0x2000;
private const int PRINTER_STATUS_PROCESSING = 0x4000;
private const int PRINTER_STATUS_INITIALIZING = 0x8000;
private const int PRINTER_STATUS_WARMING_UP = 0x10000;
private const int PRINTER_STATUS_TONER_LOW = 0x20000;
private const int PRINTER_STATUS_NO_TONER = 0x40000;
private const int PRINTER_STATUS_PAGE_PUNT = 0x80000;
private const int PRINTER_STATUS_USER_INTERVENTION = 0x100000;
private const int PRINTER_STATUS_OUT_OF_MEMORY = 0x200000;
private const int PRINTER_STATUS_DOOR_OPEN = 0x400000;
private const int PRINTER_STATUS_SERVER_UNKNOWN = 0x800000;
private const int PRINTER_STATUS_POWER_SAVE = 0x1000000;
/// <summary>
/// Get a printer status
/// </summary>
/// <param name="printerName">a valid printer name</param>
/// <param name="category">a category that should request</param>
/// <returns>a printer attribute or null</returns>
public override Object getPrinterStatus(String printerName, java.lang.Class category)
{
int cJobs;
int status;
if (GetPrinterInfo2(printerName, out cJobs, out status))
{
if (category == (java.lang.Class)typeof(javax.print.attribute.standard.PrinterState))
{
if ((status &
(PRINTER_STATUS_ERROR | PRINTER_STATUS_NO_TONER | PRINTER_STATUS_OUT_OF_MEMORY |
PRINTER_STATUS_OFFLINE | PRINTER_STATUS_USER_INTERVENTION |
PRINTER_STATUS_DOOR_OPEN | PRINTER_STATUS_NOT_AVAILABLE )) > 0)
{
return javax.print.attribute.standard.PrinterState.STOPPED;
}
if( (status & (PRINTER_STATUS_BUSY | PRINTER_STATUS_PRINTING ))> 0 )
{
return javax.print.attribute.standard.PrinterState.PROCESSING;
}
return null;
// null seems to be the default instead of unknown - UNKOWN ist not used in the reference RT
// javax.print.attribute.standard.PrinterState.UNKNOWN;
}
if (category == (java.lang.Class)typeof(javax.print.attribute.standard.PrinterStateReasons))
{
return extractResions(status);
}
if (category == (java.lang.Class)typeof(javax.print.attribute.standard.QueuedJobCount))
{
return new javax.print.attribute.standard.QueuedJobCount(cJobs);
}
if (category == (java.lang.Class)typeof(javax.print.attribute.standard.PrinterIsAcceptingJobs))
{
if ((status &
(PRINTER_STATUS_ERROR |
PRINTER_STATUS_NO_TONER |
PRINTER_STATUS_OUT_OF_MEMORY |
PRINTER_STATUS_OFFLINE |
PRINTER_STATUS_USER_INTERVENTION |
PRINTER_STATUS_DOOR_OPEN)) > 0)
{
return javax.print.attribute.standard.PrinterIsAcceptingJobs.NOT_ACCEPTING_JOBS;
}
else
{
return javax.print.attribute.standard.PrinterIsAcceptingJobs.ACCEPTING_JOBS;
}
}
}
return null;
}
private javax.print.attribute.standard.PrinterStateReasons extractResions(int status)
{
javax.print.attribute.standard.PrinterStateReasons reasons = new javax.print.attribute.standard.PrinterStateReasons();
if ((status & PRINTER_STATUS_PAUSED) > 0)
{
reasons.put(javax.print.attribute.standard.PrinterStateReason.PAUSED, javax.print.attribute.standard.Severity.REPORT);
}
if ((status & PRINTER_STATUS_ERROR) > 0)
{
reasons.put(javax.print.attribute.standard.PrinterStateReason.OTHER, javax.print.attribute.standard.Severity.ERROR);
}
if ((status & PRINTER_STATUS_PENDING_DELETION) > 0) { }
if ((status & PRINTER_STATUS_PAPER_JAM) > 0)
{
reasons.put(javax.print.attribute.standard.PrinterStateReason.MEDIA_JAM, javax.print.attribute.standard.Severity.WARNING);
}
if ((status & PRINTER_STATUS_PAPER_OUT) > 0)
{
reasons.put(javax.print.attribute.standard.PrinterStateReason.MEDIA_EMPTY, javax.print.attribute.standard.Severity.WARNING);
}
if ((status & PRINTER_STATUS_MANUAL_FEED) > 0) { }
if ((status & PRINTER_STATUS_PAPER_PROBLEM) > 0) {}
if ((status & PRINTER_STATUS_OFFLINE) > 0) {
reasons.put(javax.print.attribute.standard.PrinterStateReason.TIMED_OUT, javax.print.attribute.standard.Severity.ERROR);
}
if ((status & PRINTER_STATUS_IO_ACTIVE) > 0) { }
if ((status & PRINTER_STATUS_BUSY) > 0) { }
if ((status & PRINTER_STATUS_PRINTING) > 0) { }
if ((status & PRINTER_STATUS_OUTPUT_BIN_FULL) > 0) {
reasons.put(javax.print.attribute.standard.PrinterStateReason.OUTPUT_AREA_FULL, javax.print.attribute.standard.Severity.WARNING);
}
if ((status & PRINTER_STATUS_NOT_AVAILABLE) > 0) { }
if ((status & PRINTER_STATUS_WAITING) > 0) { }
if ((status & PRINTER_STATUS_PROCESSING) > 0) { }
if ((status & PRINTER_STATUS_INITIALIZING) > 0) { }
if ((status & PRINTER_STATUS_WARMING_UP) > 0) { }
if ((status & PRINTER_STATUS_TONER_LOW) > 0) {
reasons.put(javax.print.attribute.standard.PrinterStateReason.TONER_LOW, javax.print.attribute.standard.Severity.WARNING);
}
if ((status & PRINTER_STATUS_NO_TONER) > 0) {
reasons.put(javax.print.attribute.standard.PrinterStateReason.TONER_EMPTY, javax.print.attribute.standard.Severity.ERROR);
}
if ((status & PRINTER_STATUS_PAGE_PUNT) > 0) { }
if ((status & PRINTER_STATUS_USER_INTERVENTION) > 0) {
reasons.put(javax.print.attribute.standard.PrinterStateReason.OTHER, javax.print.attribute.standard.Severity.ERROR);
}
if ((status & PRINTER_STATUS_OUT_OF_MEMORY) > 0) {
reasons.put(javax.print.attribute.standard.PrinterStateReason.OTHER, javax.print.attribute.standard.Severity.ERROR);
}
if ((status & PRINTER_STATUS_DOOR_OPEN) > 0) {
reasons.put(javax.print.attribute.standard.PrinterStateReason.DOOR_OPEN, javax.print.attribute.standard.Severity.ERROR);
}
if ((status & PRINTER_STATUS_SERVER_UNKNOWN) > 0) { }
if ((status & PRINTER_STATUS_POWER_SAVE) > 0) {
reasons.put(javax.print.attribute.standard.PrinterStateReason.PAUSED, javax.print.attribute.standard.Severity.REPORT);
}
return reasons.isEmpty() ? null : reasons;
}
/// <summary>
/// Get infos from the PRINTER_INFO_2 struc
/// </summary>
/// <param name="printerName">The name of a valid printer</param>
/// <param name="cJobs">returns the current count of print jobs</param>
/// <param name="status">returns the current status of the printer</param>
/// <returns>true if the return is valid</returns>
[System.Security.SecuritySafeCritical]
private static bool GetPrinterInfo2(string printerName, out int cJobs, out int status)
{
SafePrinterHandle printer = null;
try
{
int needed = 0;
if (OpenPrinter(printerName, out printer, IntPtr.Zero)
&& !GetPrinter(printer, 2, IntPtr.Zero, 0, out needed))
{
int lastWin32Error = Marshal.GetLastWin32Error();
if (lastWin32Error == ERROR_INSUFFICIENT_BUFFER)
{
IntPtr pPrinter = Marshal.AllocHGlobal((int)needed);
try
{
if (GetPrinter(printer, 2, pPrinter, needed, out needed))
{
PRINTER_INFO_2 printerInfo2 = (PRINTER_INFO_2)Marshal.PtrToStructure(pPrinter, typeof(PRINTER_INFO_2));
cJobs = printerInfo2.cJobs;
status = printerInfo2.Status;
return true;
}
}
finally
{
Marshal.FreeHGlobal(pPrinter);
}
}
}
}
finally
{
if (printer != null)
{
printer.Close();
}
}
cJobs = 0;
status = 0;
return false;
}
}
[System.Security.SecurityCritical]
sealed class SafePrinterHandle : SafeHandleZeroOrMinusOneIsInvalid
{
[DllImport("winspool.drv")]
private static extern bool ClosePrinter(IntPtr hPrinter);
private SafePrinterHandle()
: base(true)
{
}
[System.Security.SecurityCritical]
protected override bool ReleaseHandle()
{
return ClosePrinter(handle);
}
}
class Win32Print
{
}
}

404
external/ikvm/awt/robot.cs vendored Normal file
View File

@@ -0,0 +1,404 @@
/*
Copyright (C) 2007 Volker Berlin
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
*/
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using java.awt.peer;
using java.awt.@event;
namespace ikvm.awt
{
internal class WindowsRobot : RobotPeer
{
internal WindowsRobot(java.awt.GraphicsDevice device)
{
}
public void dispose()
{
}
public int getRGBPixel(int x, int y)
{
Bitmap bitmap = new Bitmap(1, 1);
Graphics g = Graphics.FromImage(bitmap);
g.CopyFromScreen( x, y, 0, 0, new Size(1,1));
g.Dispose();
Color color = bitmap.GetPixel(0,0);
bitmap.Dispose();
return color.ToArgb();
}
public int[] getRGBPixels(java.awt.Rectangle r)
{
int width = r.width;
int height = r.height;
Bitmap bitmap = new Bitmap(width, height);
Graphics g = Graphics.FromImage(bitmap);
g.CopyFromScreen(r.x, r.y, 0, 0, new Size(width, height));
g.Dispose();
int[] pixels = new int[width * height];
for (int i = 0; i < width; i++)
{
for (int j = 0; j < height; j++)
{
pixels[i+j*width] = bitmap.GetPixel(i, j).ToArgb();
}
}
bitmap.Dispose();
return pixels;
}
private byte MapKeyCode(int keyCode)
{
//TODO there need a keymap for some special chars
//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
switch (keyCode)
{
case KeyEvent.VK_DELETE:
return VK_DELETE;
default:
return (byte)keyCode;
}
}
public void keyPress(int keycode)
{
keybd_event(MapKeyCode(keycode), 0, KEYEVENTF_KEYDOWN, IntPtr.Zero);
}
public void keyRelease(int keycode)
{
keybd_event(MapKeyCode(keycode), 0, KEYEVENTF_KEYUP, IntPtr.Zero);
}
public void mouseMove(int x, int y)
{
Cursor.Position = new Point(x,y);
}
public void mousePress(int button)
{
int dwFlags = 0;
switch (button)
{
case InputEvent.BUTTON1_MASK:
dwFlags |= MOUSEEVENTF_LEFTDOWN;
break;
case InputEvent.BUTTON2_MASK:
dwFlags |= MOUSEEVENTF_MIDDLEDOWN;
break;
case InputEvent.BUTTON3_MASK:
dwFlags |= MOUSEEVENTF_RIGHTDOWN;
break;
}
mouse_event(dwFlags, 0, 0, 0, IntPtr.Zero);
}
public void mouseRelease(int button)
{
int dwFlags = 0;
switch (button)
{
case InputEvent.BUTTON1_MASK:
dwFlags |= MOUSEEVENTF_LEFTUP;
break;
case InputEvent.BUTTON2_MASK:
dwFlags |= MOUSEEVENTF_MIDDLEUP;
break;
case InputEvent.BUTTON3_MASK:
dwFlags |= MOUSEEVENTF_RIGHTUP;
break;
}
mouse_event(dwFlags, 0, 0, 0, IntPtr.Zero);
}
public void mouseWheel(int wheel)
{
mouse_event(0, 0, 0, wheel, IntPtr.Zero);
}
[DllImport("user32.dll")]
private static extern void keybd_event(byte vk, byte scan, int flags, IntPtr extrainfo);
private const int KEYEVENTF_KEYDOWN = 0x0000;
private const int KEYEVENTF_KEYUP = 0x0002;
[DllImport("user32.dll")]
private static extern void mouse_event(
int dwFlags, // motion and click options
int dx, // horizontal position or change
int dy, // vertical position or change
int dwData, // wheel movement
IntPtr dwExtraInfo // application-defined information
);
private const int MOUSEEVENTF_LEFTDOWN = 0x0002;
private const int MOUSEEVENTF_LEFTUP = 0x0004;
private const int MOUSEEVENTF_RIGHTDOWN = 0x0008;
private const int MOUSEEVENTF_RIGHTUP = 0x0010;
private const int MOUSEEVENTF_MIDDLEDOWN = 0x0020;
private const int MOUSEEVENTF_MIDDLEUP = 0x0040;
private const int VK_BACK = 0x08;
private const int VK_TAB = 0x09;
/*
* 0x0A - 0x0B : reserved
*/
private const int VK_CLEAR = 0x0C;
private const int VK_RETURN = 0x0D;
private const int VK_SHIFT = 0x10;
private const int VK_CONTROL = 0x11;
private const int VK_MENU = 0x12;
private const int VK_PAUSE = 0x13;
private const int VK_CAPITAL = 0x14;
private const int VK_KANA = 0x15;
private const int VK_HANGEUL = 0x15; /* old name - should be here for compatibility */
private const int VK_HANGUL = 0x15;
private const int VK_JUNJA = 0x17;
private const int VK_FINAL = 0x18;
private const int VK_HANJA = 0x19;
private const int VK_KANJI = 0x19;
private const int VK_ESCAPE = 0x1B;
private const int VK_CONVERT = 0x1C;
private const int VK_NONCONVERT = 0x1D;
private const int VK_ACCEPT = 0x1E;
private const int VK_MODECHANGE = 0x1F;
private const int VK_SPACE = 0x20;
private const int VK_PRIOR = 0x21;
private const int VK_NEXT = 0x22;
private const int VK_END = 0x23;
private const int VK_HOME = 0x24;
private const int VK_LEFT = 0x25;
private const int VK_UP = 0x26;
private const int VK_RIGHT = 0x27;
private const int VK_DOWN = 0x28;
private const int VK_SELECT = 0x29;
private const int VK_PRINT = 0x2A;
private const int VK_EXECUTE = 0x2B;
private const int VK_SNAPSHOT = 0x2C;
private const int VK_INSERT = 0x2D;
private const int VK_DELETE = 0x2E;
private const int VK_HELP = 0x2F;
/*
* VK_0 - VK_9 are the same as ASCII '0' - '9' (0x30 - 0x39)
* 0x40 : unassigned
* VK_A - VK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A)
*/
private const int VK_LWIN = 0x5B;
private const int VK_RWIN = 0x5C;
private const int VK_APPS = 0x5D;
/*
* 0x5E : reserved
*/
private const int VK_SLEEP = 0x5F;
private const int VK_NUMPAD0 = 0x60;
private const int VK_NUMPAD1 = 0x61;
private const int VK_NUMPAD2 = 0x62;
private const int VK_NUMPAD3 = 0x63;
private const int VK_NUMPAD4 = 0x64;
private const int VK_NUMPAD5 = 0x65;
private const int VK_NUMPAD6 = 0x66;
private const int VK_NUMPAD7 = 0x67;
private const int VK_NUMPAD8 = 0x68;
private const int VK_NUMPAD9 = 0x69;
private const int VK_MULTIPLY = 0x6A;
private const int VK_ADD = 0x6B;
private const int VK_SEPARATOR = 0x6C;
private const int VK_SUBTRACT = 0x6D;
private const int VK_DECIMAL = 0x6E;
private const int VK_DIVIDE = 0x6F;
private const int VK_F1 = 0x70;
private const int VK_F2 = 0x71;
private const int VK_F3 = 0x72;
private const int VK_F4 = 0x73;
private const int VK_F5 = 0x74;
private const int VK_F6 = 0x75;
private const int VK_F7 = 0x76;
private const int VK_F8 = 0x77;
private const int VK_F9 = 0x78;
private const int VK_F10 = 0x79;
private const int VK_F11 = 0x7A;
private const int VK_F12 = 0x7B;
private const int VK_F13 = 0x7C;
private const int VK_F14 = 0x7D;
private const int VK_F15 = 0x7E;
private const int VK_F16 = 0x7F;
private const int VK_F17 = 0x80;
private const int VK_F18 = 0x81;
private const int VK_F19 = 0x82;
private const int VK_F20 = 0x83;
private const int VK_F21 = 0x84;
private const int VK_F22 = 0x85;
private const int VK_F23 = 0x86;
private const int VK_F24 = 0x87;
/*
* 0x88 - 0x8F : unassigned
*/
private const int VK_NUMLOCK = 0x90;
private const int VK_SCROLL = 0x91;
/*
* NEC PC-9800 kbd definitions
*/
private const int VK_OEM_NEC_EQUAL = 0x92; // '=' key on numpad
/*
* Fujitsu/OASYS kbd definitions
*/
private const int VK_OEM_FJ_JISHO = 0x92; // 'Dictionary' key
private const int VK_OEM_FJ_MASSHOU= 0x93; // 'Unregister word' key
private const int VK_OEM_FJ_TOUROKU= 0x94; // 'Register word' key
private const int VK_OEM_FJ_LOYA = 0x95; // 'Left OYAYUBI' key
private const int VK_OEM_FJ_ROYA = 0x96; // 'Right OYAYUBI' key
/*
* 0x97 - 0x9F : unassigned
*/
/*
* VK_L* & VK_R* - left and right Alt, Ctrl and Shift virtual keys.
* Used only as parameters to GetAsyncKeyState() and GetKeyState().
* No other API or message will distinguish left and right keys in this way.
*/
private const int VK_LSHIFT = 0xA0;
private const int VK_RSHIFT = 0xA1;
private const int VK_LCONTROL = 0xA2;
private const int VK_RCONTROL = 0xA3;
private const int VK_LMENU = 0xA4;
private const int VK_RMENU = 0xA5;
private const int VK_BROWSER_BACK = 0xA6;
private const int VK_BROWSER_FORWARD = 0xA7;
private const int VK_BROWSER_REFRESH = 0xA8;
private const int VK_BROWSER_STOP = 0xA9;
private const int VK_BROWSER_SEARCH = 0xAA;
private const int VK_BROWSER_FAVORITES = 0xAB;
private const int VK_BROWSER_HOME = 0xAC;
private const int VK_VOLUME_MUTE = 0xAD;
private const int VK_VOLUME_DOWN = 0xAE;
private const int VK_VOLUME_UP = 0xAF;
private const int VK_MEDIA_NEXT_TRACK = 0xB0;
private const int VK_MEDIA_PREV_TRACK = 0xB1;
private const int VK_MEDIA_STOP = 0xB2;
private const int VK_MEDIA_PLAY_PAUSE = 0xB3;
private const int VK_LAUNCH_MAIL = 0xB4;
private const int VK_LAUNCH_MEDIA_SELECT= 0xB5;
private const int VK_LAUNCH_APP1 = 0xB6;
private const int VK_LAUNCH_APP2 = 0xB7;
/*
* 0xB8 - 0xB9 : reserved
*/
private const int VK_OEM_1 = 0xBA; // ';:' for US
private const int VK_OEM_PLUS = 0xBB; // '+' any country
private const int VK_OEM_COMMA = 0xBC; // ',' any country
private const int VK_OEM_MINUS = 0xBD; // '-' any country
private const int VK_OEM_PERIOD = 0xBE; // '.' any country
private const int VK_OEM_2 = 0xBF; // '/?' for US
private const int VK_OEM_3 = 0xC0; // '`~' for US
/*
* 0xC1 - 0xD7 : reserved
*/
/*
* 0xD8 - 0xDA : unassigned
*/
private const int VK_OEM_4 = 0xDB; // '[{' for US
private const int VK_OEM_5 = 0xDC; // '\|' for US
private const int VK_OEM_6 = 0xDD; // ']}' for US
private const int VK_OEM_7 = 0xDE; // ''"' for US
private const int VK_OEM_8 = 0xDF;
/*
* 0xE0 : reserved
*/
/*
* Various extended or enhanced keyboards
*/
private const int VK_OEM_AX = 0xE1; // 'AX' key on Japanese AX kbd
private const int VK_OEM_102 = 0xE2; // "<>" or "\|" on RT 102-key kbd.
private const int VK_ICO_HELP = 0xE3; // Help key on ICO
private const int VK_ICO_00 = 0xE4; // 00 key on ICO
/*
* 0xE8 : unassigned
*/
/*
* Nokia/Ericsson definitions
*/
private const int VK_OEM_RESET = 0xE9;
private const int VK_OEM_JUMP = 0xEA;
private const int VK_OEM_PA1 = 0xEB;
private const int VK_OEM_PA2 = 0xEC;
private const int VK_OEM_PA3 = 0xED;
private const int VK_OEM_WSCTRL = 0xEE;
private const int VK_OEM_CUSEL = 0xEF;
private const int VK_OEM_ATTN = 0xF0;
private const int VK_OEM_FINISH = 0xF1;
private const int VK_OEM_COPY = 0xF2;
private const int VK_OEM_AUTO = 0xF3;
private const int VK_OEM_ENLW = 0xF4;
private const int VK_OEM_BACKTAB = 0xF5;
private const int VK_ATTN = 0xF6;
private const int VK_CRSEL = 0xF7;
private const int VK_EXSEL = 0xF8;
private const int VK_EREOF = 0xF9;
private const int VK_PLAY = 0xFA;
private const int VK_ZOOM = 0xFB;
private const int VK_NONAME = 0xFC;
private const int VK_PA1 = 0xFD;
private const int VK_OEM_CLEAR = 0xFE;
}
}

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