diff options
author | Graeme Geldenhuys <graemeg@users.sourceforge.net> | 2006-11-18 18:11:20 +0000 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@users.sourceforge.net> | 2006-11-18 18:11:20 +0000 |
commit | 8fe7ea95a343a35dc286bd9a13d257d285e9c4e1 (patch) | |
tree | ea9f9317f46f4c320a2667e0e0d4362c4f0980a3 | |
parent | 546dce65494ea4e5f654e2840cc67307101e06f7 (diff) | |
download | fpGUI-8fe7ea95a343a35dc286bd9a13d257d285e9c4e1.tar.xz |
Initial checkin. Merged fpGUI, fpGFX and fpIMG from the OpenSoft sever.
171 files changed, 62100 insertions, 0 deletions
diff --git a/AUTHORS.txt b/AUTHORS.txt new file mode 100644 index 00000000..9efac32c --- /dev/null +++ b/AUTHORS.txt @@ -0,0 +1,13 @@ +Original Author +-------- ------ +Sebastian Guenther <sg@freepascal.org> + +Main Author +----------- +Graeme Geldenhuys <graemeg@gmail.com> + +Contributors +------------ +Felipe Monteiro de Carvalho <felipemonteiro.carvalho@gmail.com> +Andrew Haines <andrewd207@aol.com> + diff --git a/COPYING.modifiedLGPL b/COPYING.modifiedLGPL new file mode 100644 index 00000000..7e74bb3a --- /dev/null +++ b/COPYING.modifiedLGPL @@ -0,0 +1,25 @@ +This is the file COPYING.modifiedLGPL, it applies to all fpGFX sources +distributed by members of the fpGFX Development Team. +All files contains headers showing the appropriate license. + +These files are distributed under the GNU Library Public License +(see the file COPYING) with the following modification: + +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. + + +If you didn't receive a copy of the file COPYING, contact: + Free Software Foundation, Inc., + 675 Mass Ave + Cambridge, MA 02139 + USA + diff --git a/COPYING.txt b/COPYING.txt new file mode 100644 index 00000000..223ede7d --- /dev/null +++ b/COPYING.txt @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 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. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. 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 library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..f712c3af --- /dev/null +++ b/Makefile @@ -0,0 +1,1900 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/07/01] +# +default: all +MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-palmos arm-wince arm-gba powerpc64-linux +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +FPC:=$(shell $(FPCPROG) -PB) +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +FOUNDFPC:=$(strip $(wildcard $(FPC))) +ifeq ($(FOUNDFPC),) +FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))) +ifeq ($(FOUNDFPC),) +$(error Compiler $(FPC) not found) +endif +endif +ifndef FPC_COMPILERINFO +FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO) +endif +ifndef FPC_VERSION +FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO)) +endif +export FPC FPC_VERSION FPC_COMPILERINFO +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +OS_TARGET:=$(word 5,$(FPC_COMPILERINFO)) +endif +FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +TARGETSUFFIX=$(OS_TARGET) +SOURCESUFFIX=$(OS_SOURCE) +else +TARGETSUFFIX=$(FULL_TARGET) +SOURCESUFFIX=$(FULL_SOURCE) +endif +ifneq ($(FULL_TARGET),$(FULL_SOURCE)) +CROSSCOMPILE=1 +endif +ifeq ($(findstring makefile,$(MAKECMDGOALS)),) +ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_DIRS+=src +endif +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-go32v2) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-win32) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-os2) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-freebsd) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-beos) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-netbsd) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-solaris) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-qnx) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-netware) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-openbsd) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-wdosx) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-darwin) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-emx) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-watcom) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),i386-wince) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),m68k-linux) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),m68k-amiga) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),m68k-atari) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),m68k-palmos) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),powerpc-linux) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),powerpc-macos) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),sparc-linux) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),sparc-solaris) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),x86_64-linux) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),x86_64-win64) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),arm-linux) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),arm-palmos) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),arm-wince) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),arm-gba) +override TARGET_EXAMPLEDIRS+=examples +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +override TARGET_EXAMPLEDIRS+=examples +endif +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef COMPILER_UNITTARGETDIR +ifdef PACKAGEDIR_MAIN +COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX) +else +COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX) +endif +endif +ifndef COMPILER_TARGETDIR +COMPILER_TARGETDIR=. +endif +ifndef INSTALL_BASEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +ifdef CROSSCOMPILE +ifdef CROSSINSTALL +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX) +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +endif +endif +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +endif +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +FPCMADE=fpcmade.$(SHORTSUFFIX) +ZIPSUFFIX=$(SHORTSUFFIX) +ZIPCROSSPREFIX= +ZIPSOURCESUFFIX=src +ZIPEXAMPLESUFFIX=exm +else +FPCMADE=fpcmade.$(TARGETSUFFIX) +ZIPSOURCESUFFIX=.source +ZIPEXAMPLESUFFIX=.examples +ifdef CROSSCOMPILE +ZIPSUFFIX=.$(SOURCESUFFIX) +ZIPCROSSPREFIX=$(TARGETSUFFIX)- +else +ZIPSUFFIX=.$(TARGETSUFFIX) +ZIPCROSSPREFIX= +endif +endif +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= __missing_command_MVPROG +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef MKDIRPROG +MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG= __missing_command_MKDIRPROG +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +endif +export MKDIRPROG +ifndef ECHOREDIR +ifndef inUnix +ECHOREDIR=echo +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= __missing_command_PPUMOVE +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O2 +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifdef LINKSHARED +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_examples +ifneq ($(TARGET_EXAMPLES),) +HASEXAMPLES=1 +override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES)) $(addsuffix .lpr,$(TARGET_EXAMPLES)) $(addsuffix .dpr,$(TARGET_EXAMPLES))) +override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES)) +override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES))) +override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES)) +endif +ifeq ($(OS_TARGET),emx) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES)) +endif +endif +ifneq ($(TARGET_EXAMPLEDIRS),) +HASEXAMPLES=1 +endif +fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(TARGET_EXAMPLEDIRS)) +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +fpc_cleanall: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef COMPILER_UNITTARGETDIR +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +endif + -$(DELTREE) units + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) +ifneq ($(PPUEXT),.ppu) + -$(DEL) *.o *.ppu *.a +endif + -$(DELTREE) *$(SMARTEXT) + -$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(ECHO) Target OS.... $(OS_TARGET) + @$(ECHO) Full Source.. $(FULL_SOURCE) + @$(ECHO) Full Target.. $(FULL_TARGET) + @$(ECHO) SourceSuffix. $(SOURCESUFFIX) + @$(ECHO) TargetSuffix. $(TARGETSUFFIX) + @$(ECHO) + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) + @$(ECHO) DateStr.............. $(DATESTR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipCrossPrefix....... $(ZIPCROSSPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) FullZipName.......... $(FULLZIPNAME) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) + @$(ECHO) + @$(ECHO) Install base dir..... $(INSTALL_BASEDIR) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +ifeq ($(FULL_TARGET),i386-linux) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +TARGET_DIRS_SRC=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +TARGET_DIRS_SRC=1 +endif +ifdef TARGET_DIRS_SRC +src_all: + $(MAKE) -C src all +src_debug: + $(MAKE) -C src debug +src_smart: + $(MAKE) -C src smart +src_release: + $(MAKE) -C src release +src_units: + $(MAKE) -C src units +src_examples: + $(MAKE) -C src examples +src_shared: + $(MAKE) -C src shared +src_install: + $(MAKE) -C src install +src_sourceinstall: + $(MAKE) -C src sourceinstall +src_exampleinstall: + $(MAKE) -C src exampleinstall +src_distinstall: + $(MAKE) -C src distinstall +src_zipinstall: + $(MAKE) -C src zipinstall +src_zipsourceinstall: + $(MAKE) -C src zipsourceinstall +src_zipexampleinstall: + $(MAKE) -C src zipexampleinstall +src_zipdistinstall: + $(MAKE) -C src zipdistinstall +src_clean: + $(MAKE) -C src clean +src_distclean: + $(MAKE) -C src distclean +src_cleanall: + $(MAKE) -C src cleanall +src_info: + $(MAKE) -C src info +src_makefiles: + $(MAKE) -C src makefiles +src: + $(MAKE) -C src all +.PHONY: src_all src_debug src_smart src_release src_units src_examples src_shared src_install src_sourceinstall src_exampleinstall src_distinstall src_zipinstall src_zipsourceinstall src_zipexampleinstall src_zipdistinstall src_clean src_distclean src_cleanall src_info src_makefiles src +endif +ifeq ($(FULL_TARGET),i386-linux) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-go32v2) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-win32) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-os2) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-freebsd) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-beos) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-netbsd) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-solaris) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-qnx) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-netware) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-openbsd) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-wdosx) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-darwin) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-emx) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-watcom) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-netwlibc) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),i386-wince) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),m68k-linux) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),m68k-freebsd) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),m68k-netbsd) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),m68k-amiga) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),m68k-atari) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),m68k-openbsd) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),m68k-palmos) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),powerpc-linux) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),powerpc-netbsd) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),powerpc-macos) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),powerpc-darwin) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),powerpc-morphos) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),sparc-linux) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),sparc-netbsd) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),sparc-solaris) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),x86_64-linux) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),x86_64-freebsd) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),x86_64-win64) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),arm-linux) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),arm-palmos) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),arm-wince) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),arm-gba) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifeq ($(FULL_TARGET),powerpc64-linux) +TARGET_EXAMPLEDIRS_EXAMPLES=1 +endif +ifdef TARGET_EXAMPLEDIRS_EXAMPLES +examples_all: + $(MAKE) -C examples all +examples_debug: + $(MAKE) -C examples debug +examples_smart: + $(MAKE) -C examples smart +examples_release: + $(MAKE) -C examples release +examples_units: + $(MAKE) -C examples units +examples_examples: + $(MAKE) -C examples examples +examples_shared: + $(MAKE) -C examples shared +examples_install: + $(MAKE) -C examples install +examples_sourceinstall: + $(MAKE) -C examples sourceinstall +examples_exampleinstall: + $(MAKE) -C examples exampleinstall +examples_distinstall: + $(MAKE) -C examples distinstall +examples_zipinstall: + $(MAKE) -C examples zipinstall +examples_zipsourceinstall: + $(MAKE) -C examples zipsourceinstall +examples_zipexampleinstall: + $(MAKE) -C examples zipexampleinstall +examples_zipdistinstall: + $(MAKE) -C examples zipdistinstall +examples_clean: + $(MAKE) -C examples clean +examples_distclean: + $(MAKE) -C examples distclean +examples_cleanall: + $(MAKE) -C examples cleanall +examples_info: + $(MAKE) -C examples info +examples_makefiles: + $(MAKE) -C examples makefiles +examples: + $(MAKE) -C examples all +.PHONY: examples_all examples_debug examples_smart examples_release examples_units examples_examples examples_shared examples_install examples_sourceinstall examples_exampleinstall examples_distinstall examples_zipinstall examples_zipsourceinstall examples_zipexampleinstall examples_zipdistinstall examples_clean examples_distclean examples_cleanall examples_info examples_makefiles examples +endif +all: $(addsuffix _all,$(TARGET_DIRS)) +debug: $(addsuffix _debug,$(TARGET_DIRS)) +smart: $(addsuffix _smart,$(TARGET_DIRS)) +release: $(addsuffix _release,$(TARGET_DIRS)) +units: $(addsuffix _units,$(TARGET_DIRS)) +examples: fpc_examples $(addsuffix _examples,$(TARGET_DIRS)) +shared: $(addsuffix _shared,$(TARGET_DIRS)) +install: $(addsuffix _install,$(TARGET_DIRS)) +sourceinstall: $(addsuffix _sourceinstall,$(TARGET_DIRS)) +exampleinstall: $(addsuffix _exampleinstall,$(TARGET_DIRS)) +distinstall: $(addsuffix _distinstall,$(TARGET_DIRS)) +zipinstall: $(addsuffix _zipinstall,$(TARGET_DIRS)) +zipsourceinstall: $(addsuffix _zipsourceinstall,$(TARGET_DIRS)) +zipexampleinstall: $(addsuffix _zipexampleinstall,$(TARGET_DIRS)) +zipdistinstall: $(addsuffix _zipdistinstall,$(TARGET_DIRS)) +clean: $(addsuffix _clean,$(TARGET_DIRS)) $(addsuffix _clean,$(TARGET_EXAMPLEDIRS)) +distclean: $(addsuffix _distclean,$(TARGET_DIRS)) +cleanall: $(addsuffix _cleanall,$(TARGET_DIRS)) +info: fpc_info +makefiles: fpc_makefiles $(addsuffix _makefiles,$(TARGET_DIRS)) +.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif diff --git a/Makefile.fpc b/Makefile.fpc new file mode 100644 index 00000000..3426c475 --- /dev/null +++ b/Makefile.fpc @@ -0,0 +1,7 @@ +# +# Makefile.fpc for fpGFX base tree +# + +[target] +dirs=src +exampledirs=examples diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 00000000..0b44b796 --- /dev/null +++ b/TODO.txt @@ -0,0 +1,51 @@ + + These are all the noted issues with fpGUI so far. + -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +* Selecting text in a Edit field doesn't work. + +* Password edit resizes while you are typing. (minor property fix required) + +* Scrollbar doesn't scroll when you keep the mouse clicked on the up or down + arrows of the scrollbar. + +* (fixed) Scrollbar PageSize property doesn't work 100%. See widgettest demo. + +* Scrollbox seems to work, as it is used internally in the ListBox component. + The demo in the Widget Test Demo app needs to improve though. + +* ComboBox component needs to be completed. + - The dropdown window has borders. (fixed but needs testing). + - The arrow button doesn't close the dropdown window. (fixed but needs testing) + - Text input doesn't work. (n/a combobox is a selection only component) + - Dropdown window width is incorrect. + - Dropdown doesn't close when combobox looses focus. + +* (started) Menu's need to be implemented. + +* Label component needs to be enhanced to allow for keyboard shortcuts and + underline the keyboard shortcut letter. + +* Dialog components need to be added to the Widget Test Demo. + +* More standard dialog components need to be added. Example: File Dialog, + Color Dialog, Diretory Select Dialog, etc. + +* Tab component needs to be created. + +* Toolbar component needs to be created. + +* Treeview component needs to be created. Maybe look at porting the + Virtual Treeview component. That can double up as a altenate ListBox + component as well. + +* Slider component + +* (completed basics) Progress Bar component + +* (completed basics) Panel component + +* (started) Gauge/Dial/Needle component. + + + -------oO0Oo------- diff --git a/docs/build_docs.sh b/docs/build_docs.sh new file mode 100755 index 00000000..3d923372 --- /dev/null +++ b/docs/build_docs.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# fpc/bin must be in your PATH +fpdoc --package=fpgui --format=html --output=html/ \ + --descr=xml/fpgui.xml --input='-Fi../src ../src/fpgui.pp' + diff --git a/docs/colors/color_names.html b/docs/colors/color_names.html new file mode 100644 index 00000000..2f8e1721 --- /dev/null +++ b/docs/colors/color_names.html @@ -0,0 +1,860 @@ +<html><head><title>Color Name Samples</title> + + + +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<style type="text/css"> +<!-- +.table { font-family: courier; font-size: smaller; font-weight: bold} +.tablewhite { font-family: courier; font-size: smaller; font-weight: bold ; color: #FFFFFF} +--> +</style></head><body bgcolor="#ffffff" link="#770000" vlink="#003399"> +<p><font face="Trebuchet MS, Arial, Helvetica, sans-serif" size="+2"><a name="top"></a>Color + Name Samples</font></p> +<table border="0" width="90%"> +<tbody><tr> +<td colspan="4"> +The 140 web color names are displayed alphabetically in the table below along + with their respective RGB values. +</td> +</tr> +</tbody></table> +<p> +<table border="1" cellpadding="6" cellspacing="3" width="90%"> + <tbody><tr> + <td bgcolor="aliceblue" width="25%"> + <p>aliceblue</p> + <p class="table">240,248,255<br> + F0F8FF </p> + </td> + <td bgcolor="darkslategray" width="25%"> + <p><font color="#ffffff">darkslategray</font></p> + <p class="tablewhite">47,79,79<br> + 2F4F4F </p> + </td> + <td bgcolor="lightsalmon" width="25%"> + <p>lightsalmon</p> + <p class="table">255,160,122<br> + FFA07A </p> + </td> + <td bgcolor="palevioletred" width="25%"> + <p>palevioletred</p> + <p class="table">219,112,147<br> + DB7093 </p> + </td> + </tr> + <tr> + <td bgcolor="antiquewhite" width="25%"> + <p>antiquewhite</p> + <p class="table">250,235,215<br> + FAEBD7 </p> + </td> + <td bgcolor="darkturquoise" width="25%"> + <p>darkturquoise</p> + <p class="table">0,206,209<br> + 00CED1 </p> + </td> + <td bgcolor="lightseagreen" width="25%"> + <p><font color="#000000">lightseagreen</font></p> + <p class="table">32,178,170<br> + 20B2AA </p> + </td> + <td bgcolor="papayawhip" width="25%"> + <p>papayawhip</p> + <p class="table">255,239,213<br> + FFEFD5 </p> + </td> + </tr> + <tr> + <td bgcolor="aqua" width="25%"> + <p>aqua</p> + <p class="table">0,255,255<br> + 00FFFF </p> + </td> + <td bgcolor="darkviolet" width="25%"> + <p><font color="#ffffff">darkviolet</font></p> + <p class="tablewhite">148,0,211<br> + 9400D3 </p> + </td> + <td bgcolor="lightskyblue" width="25%"> + <p>lightskyblue</p> + <p class="table">135,206,250<br> + 87CEFA </p> + </td> + <td bgcolor="peachpuff" width="25%"> + <p>peachpuff</p> + <p class="table">255,239,213<br> + FFDAB9 + </p> + </td> + </tr> + <tr> + <td bgcolor="aquamarine" width="25%"> + <p>aquamarine</p> + <p class="table">127,255,212<br> + 7FFFD4 </p> + </td> + <td bgcolor="deeppink" width="25%"> + <p><font color="#ffffff">deeppink</font></p> + <p class="tablewhite">255,20,147<br> + FF1493 </p> + </td> + <td bgcolor="lightslategray" width="25%"> + <p>lightslategray</p> + <p class="table">119,136,153<br> + 778899 </p> + </td> + <td bgcolor="peru" width="25%"> + <p>peru</p> + <p class="table">205,133,63<br> + CD853F </p> + </td> + </tr> + <tr> + <td bgcolor="azure" width="25%"> + <p>azure</p> + <p class="table">240,255,255<br> + F0FFFF </p> + </td> + <td bgcolor="deepskyblue" width="25%"> + <p>deepskyblue</p> + <p class="table">0,191,255<br> + 00BFFF </p> + </td> + <td bgcolor="lightsteelblue" width="25%"> + <p>lightsteelblue</p> + <p class="table">176,196,222<br> + B0C4DE </p> + </td> + <td bgcolor="pink" width="25%"> + <p>pink</p> + <p class="table">255,192,203<br> + FFC0CB </p> + </td> + </tr> + <tr> + <td bgcolor="beige" width="25%"> + <p>beige</p> + <p class="table">245,245,220<br> + F5F5DC </p> + </td> + <td bgcolor="dimgray" width="25%"> + <p><font color="#ffffff">dimgray</font></p> + <p class="tablewhite">105,105,105<br> + 696969 </p> + </td> + <td bgcolor="lightyellow" width="25%"> + <p>lightyellow</p> + <p class="table">255,255,224<br> + FFFFE0 </p> + </td> + <td bgcolor="plum" width="25%"> + <p>plum</p> + <p class="table">221,160,221<br> + DDA0DD </p> + </td> + </tr> + <tr> + <td bgcolor="bisque" width="25%"> + <p>bisque</p> + <p class="table">255,228,196<br> + FFE4C4 </p> + </td> + <td bgcolor="dodgerblue" width="25%"> + <p>dodgerblue</p> + <p class="table">30,144,255<br> + 1E90FF </p> + </td> + <td bgcolor="lime" width="25%"> + <p>lime</p> + <p class="table">0,255,0<br> + 00FF00 </p> + </td> + <td bgcolor="powderblue" width="25%"> + <p>powderblue</p> + <p class="table">176,224,230<br> + B0E0E6 </p> + </td> + </tr> + <tr> + <td bgcolor="black" width="25%"> + <p><font color="#ffffff">black</font></p> + <p class="tablewhite">0,0,0<br> + 000000 </p> + </td> + <td bgcolor="firebrick" width="25%"> + <p><font color="#ffffff">firebrick</font></p> + <p class="tablewhite">178,34,34<br> + B22222 </p> + </td> + <td bgcolor="limegreen" width="25%"> + <p>limegreen</p> + <p class="table">50,205,50<br> + 32CD32 </p> + </td> + <td bgcolor="purple" width="25%"> + <p><font color="#ffffff">purple</font></p> + <p class="tablewhite">128,0,128<br> + 800080 </p> + </td> + </tr> + <tr> + <td bgcolor="blanchedalmond" width="25%"> + <p>blanchedalmond</p> + <p class="table">255,255,205<br> + FFEBCD + </p> + </td> + <td bgcolor="floralwhite" width="25%"> + <p>floralwhite</p> + <p class="table">255,250,240<br> + FFFAF0 </p> + </td> + <td bgcolor="linen" width="25%"> + <p>linen</p> + <p class="table">250,240,230<br> + FAF0E6 </p> + </td> + <td bgcolor="red" width="25%"> + <p><font color="#ffffff">red</font></p> + <p class="tablewhite">255,0,0<br> + FF0000</p> + </td> + </tr> + <tr> + <td bgcolor="blue" width="25%"> + <p><font color="#ffffff">blue</font></p> + <p class="tablewhite">0,0,255<br> + 0000FF </p> + </td> + <td bgcolor="forestgreen" width="25%"> + <p><font color="#ffffff">forestgreen</font></p> + <p class="tablewhite">34,139,34<br> + 228B22 </p> + </td> + <td bgcolor="magenta" width="25%"> + <p><font color="#ffffff">magenta</font></p> + <p class="tablewhite">255,0,255<br> + FF00FF </p> + </td> + <td bgcolor="rosybrown" width="25%"> + <p>rosybrown</p> + <p class="table">188,143,143<br> + BC8F8F </p> + </td> + </tr> + <tr> + <td bgcolor="blueviolet" width="25%"> + <p><font color="#ffffff">blueviolet</font></p> + <p class="tablewhite">138,43,226<br> + 8A2BE2 </p> + </td> + <td bgcolor="fuchsia" width="25%"> + <p><font color="#ffffff">fuchsia</font></p> + <p class="tablewhite">255,0,255<br> + FF00FF </p> + </td> + <td bgcolor="maroon" width="25%"> + <p><font color="#ffffff">maroon</font></p> + <p class="table">128,0,0<br> + 800000 </p> + </td> + <td bgcolor="royalblue" width="25%"> + <p><font color="#ffffff">royalblue</font></p> + <p class="tablewhite">65,105,225<br> + 4169E1 </p> + </td> + </tr> + <tr> + <td bgcolor="brown" width="25%"> + <p>brown</p> + <p class="table">165,42,42<br> + A52A2A </p> + </td> + <td bgcolor="gainsboro" width="25%"> + <p>gainsboro</p> + <p class="table">220,220,220<br> + DCDCDC </p> + </td> + <td bgcolor="mediumaquamarine" width="25%"> + <p>mediumaquamarine</p> + <p class="table">102,205,170<br> + 66CDAA </p> + </td> + <td bgcolor="saddlebrown" width="25%"> + <p><font color="#ffffff">saddlebrown</font></p> + <p class="tablewhite">139,69,19<br> + 8B4513 </p> + </td> + </tr> + <tr> + <td bgcolor="burlywood" width="25%"> + <p>burlywood</p> + <p class="table">222,184,135<br> + DEB887 </p> + </td> + <td bgcolor="ghostwhite" width="25%"> + <p>ghostwhite</p> + <p class="table">248,248,255<br> + F8F8FF </p> + </td> + <td bgcolor="mediumblue" width="25%"> + <p><font color="#ffffff">mediumblue</font></p> + <p class="tablewhite">0,0,205<br> + 0000CD </p> + </td> + <td bgcolor="salmon" width="25%"> + <p>salmon</p> + <p class="table">250,128,114<br> + FA8072 </p> + </td> + </tr> + <tr> + <td bgcolor="cadetblue" width="25%"> + <p>cadetblue</p> + <p class="table">95,158,160<br> + 5F9EA0 </p> + </td> + <td bgcolor="gold" width="25%"> + <p>gold</p> + <p class="table">255,215,0<br> + FFD700 </p> + </td> + <td bgcolor="mediumorchid" width="25%"> + <p>mediumorchid</p> + <p class="table">186,85,211<br> + BA55D3 </p> + </td> + <td bgcolor="sandybrown" width="25%"> + <p>sandybrown</p> + <p class="table">244,164,96<br> + F4A460 </p> + </td> + </tr> + <tr> + <td bgcolor="chartreuse" width="25%"> + <p>chartreuse</p> + <p class="table">127,255,0<br> + 7FFF00 </p> + </td> + <td bgcolor="goldenrod" width="25%"> + <p>goldenrod</p> + <p class="table">218,165,32<br> + DAA520 </p> + </td> + <td bgcolor="mediumpurple" width="25%"> + <p>mediumpurple</p> + <p class="table">147,112,219<br> + 9370DB </p> + </td> + <td bgcolor="seagreen" width="25%"> + <p><font color="#ffffff">seagreen</font></p> + <p class="tablewhite">46,139,87<br> + 2E8B57 </p> + </td> + </tr> + <tr> + <td bgcolor="chocolate" width="25%"> + <p>chocolate</p> + <p class="table">210,105,30<br> + D2691E </p> + </td> + <td bgcolor="gray" width="25%"> + <p>gray</p> + <p class="table">128,128,128<br> + 808080 </p> + </td> + <td bgcolor="mediumseagreen" width="25%"> + <p>mediumseagreen</p> + <p class="table">60,179,113<br> + 3CB371 </p> + </td> + <td bgcolor="seashell" width="25%"> + <p>seashell</p> + <p class="table">255,245,238<br> + FFF5EE </p> + </td> + </tr> + <tr> + <td bgcolor="coral" width="25%"> + <p>coral</p> + <p class="table">255,127,80<br> + FF7F50 </p> + </td> + <td bgcolor="green" width="25%"> + <p><font color="#ffffff">green</font></p> + <p class="tablewhite">0,128,0<br> + 008000 </p> + </td> + <td bgcolor="mediumslateblue" width="25%"> + <p>mediumslateblue</p> + <p class="table">123,104,238<br> + 7B68EE </p> + </td> + <td bgcolor="sienna" width="25%"> + <p><font color="#ffffff">sienna</font></p> + <p class="tablewhite">160,82,45<br> + A0522D </p> + </td> + </tr> + <tr> + <td bgcolor="cornflowerblue" width="25%"> + <p>cornflowerblue</p> + <p class="table">100,149,237<br> + 6495ED </p> + </td> + <td bgcolor="greenyellow" width="25%"> + <p>greenyellow</p> + <p class="table">173,255,47<br> + ADFF2F </p> + </td> + <td bgcolor="mediumspringgreen" width="25%"> + <p>mediumspringgreen</p> + <p class="table">0,250,154<br> + 00FA9A </p> + </td> + <td bgcolor="silver" width="25%"> + <p>silver</p> + <p class="table">192,192,192<br> + C0C0C0 </p> + </td> + </tr> + <tr> + <td bgcolor="cornsilk" width="25%"> + <p>cornsilk</p> + <p class="table">255,248,220<br> + FFF8DC </p> + </td> + <td bgcolor="honeydew" width="25%"> + <p>honeydew</p> + <p class="table">240,255,240<br> + F0FFF0 </p> + </td> + <td bgcolor="mediumturquoise" width="25%"> + <p>mediumturquoise</p> + <p class="table">72,209,204<br> + 48D1CC </p> + </td> + <td bgcolor="skyblue" width="25%"> + <p>skyblue</p> + <p class="table">135,206,235<br> + 87CEEB </p> + </td> + </tr> + <tr> + <td bgcolor="crimson" width="25%"> + <p><font color="#ffffff">crimson</font></p> + <p class="tablewhite">220,20,60<br> + DC143C </p> + </td> + <td bgcolor="hotpink" width="25%"> + <p>hotpink</p> + <p class="table">255,105,180<br> + FF69B4 </p> + </td> + <td bgcolor="mediumvioletred" width="25%"> + <p><font color="#ffffff">mediumvioletred</font></p> + <p class="tablewhite">199,21,133<br> + C71585 </p> + </td> + <td bgcolor="slateblue" width="25%"> + <p><font color="#ffffff">slateblue</font></p> + <p class="tablewhite">106,90,205<br> + 6A5ACD </p> + </td> + </tr> + <tr> + <td bgcolor="cyan" width="25%"> + <p>cyan</p> + <p class="table">0,255,255<br> + 00FFFF </p> + </td> + <td bgcolor="indianred" width="25%"> + <p><font color="#000000">indianred</font></p> + <p class="table">205,92,92<br> + CD5C5C </p> + </td> + <td bgcolor="midnightblue" width="25%"> + <p><font color="#ffffff">midnightblue</font></p> + <p class="tablewhite">25,25,112<br> + 191970 </p> + </td> + <td bgcolor="slategray" width="25%"> + <p><font color="#ffffff">slategray</font></p> + <p class="tablewhite">112,128,144<br> + 708090 </p> + </td> + </tr> + <tr> + <td bgcolor="darkblue" width="25%"> + <p><font color="#ffffff">darkblue</font></p> + <p class="tablewhite">0,0,139<br> + 00008B </p> + </td> + <td bgcolor="indigo" width="25%"> + <p><font color="#ffffff">indigo</font></p> + <p class="tablewhite">75,0,130<br> + 4B0082 </p> + </td> + <td bgcolor="mintcream" width="25%"> + <p>mintcream</p> + <p class="table">245,255,250<br> + F5FFFA </p> + </td> + <td bgcolor="snow" width="25%"> + <p>snow</p> + <p class="table">255,250,250<br> + FFFAFA </p> + </td> + </tr> + <tr> + <td bgcolor="darkcyan" width="25%"> + <p><font color="#ffffff">darkcyan</font></p> + <p class="tablewhite">0,139,139<br> + 008B8B </p> + </td> + <td bgcolor="ivory" width="25%"> + <p>ivory</p> + <p class="table">255,240,240<br> + FFFFF0 + </p> + </td> + <td bgcolor="mistyrose" width="25%"> + <p>mistyrose</p> + <p class="table">255,228,225<br> + FFE4E1 </p> + </td> + <td bgcolor="springgreen" width="25%"> + <p>springgreen</p> + <p class="table">0,255,127<br> + 00FF7F </p> + </td> + </tr> + <tr> + <td bgcolor="darkgoldenrod" width="25%"> + <p>darkgoldenrod</p> + <p class="table">184,134,11<br> + B8860B </p> + </td> + <td bgcolor="khaki" width="25%"> + <p>khaki</p> + <p class="table">240,230,140<br> + F0E68C </p> + </td> + <td bgcolor="moccasin" width="25%"> + <p>moccasin</p> + <p class="table">255,228,181<br> + FFE4B5 </p> + </td> + <td bgcolor="steelblue" width="25%"> + <p>steelblue</p> + <p class="table">70,130,180<br> + 4682B4 </p> + </td> + </tr> + <tr> + <td bgcolor="darkgray" width="25%"> + <p>darkgray</p> + <p class="table">169,169,169<br> + A9A9A9 </p> + </td> + <td bgcolor="lavender" width="25%"> + <p>lavender</p> + <p class="table">230,230,250<br> + E6E6FA </p> + </td> + <td bgcolor="navajowhite" width="25%"> + <p>navajowhite</p> + <p class="table">255,222,173<br> + FFDEAD </p> + </td> + <td bgcolor="tan" width="25%"> + <p>tan</p> + <p class="table">210,180,140<br> + D2B48C </p> + </td> + </tr> + <tr> + <td bgcolor="darkgreen" width="25%"> + <p><font color="#ffffff">darkgreen</font></p> + <p class="tablewhite">0,100,0<br> + 006400 </p> + </td> + <td bgcolor="lavenderblush" width="25%"> + <p>lavenderblush</p> + <p class="table">255,240,245<br> + FFF0F5 </p> + </td> + <td bgcolor="navy" width="25%"> + <p><font color="#ffffff">navy</font></p> + <p class="tablewhite">0,0,128<br> + 000080 </p> + </td> + <td bgcolor="teal" width="25%"> + <p><font color="#ffffff">teal</font></p> + <p class="tablewhite">0,128,128<br> + 008080 </p> + </td> + </tr> + <tr> + <td bgcolor="darkkhaki" width="25%"> + <p>darkkhaki</p> + <p class="table">189,183,107<br> + BDB76B </p> + </td> + <td bgcolor="lawngreen" width="25%"> + <p>lawngreen</p> + <p class="table">124,252,0<br> + 7CFC00 </p> + </td> + <td bgcolor="oldlace" width="25%"> + <p>oldlace</p> + <p class="table">253,245,230<br> + FDF5E6 </p> + </td> + <td bgcolor="thistle" width="25%"> + <p>thistle</p> + <p class="table">216,191,216<br> + D8BFD8 </p> + </td> + </tr> + <tr> + <td bgcolor="darkmagenta" width="25%"> + <p><font color="#ffffff">darkmagenta</font></p> + <p class="tablewhite">139,0,139<br> + 8B008B </p> + </td> + <td bgcolor="lemonchiffon" width="25%"> + <p>lemonchiffon</p> + <p class="table">255,250,205<br> + FFFACD </p> + </td> + <td bgcolor="olive" width="25%"> + <p><font color="#ffffff">olive</font></p> + <p class="tablewhite">128,128,0<br> + 808000 </p> + </td> + <td bgcolor="tomato" width="25%"> + <p><font color="#ffffff">tomato</font></p> + <p class="tablewhite">253,99,71<br> + FD6347 </p> + </td> + </tr> + <tr> + <td bgcolor="darkolivegreen" width="25%"> + <p><font color="#ffffff">darkolivegreen</font></p> + <p class="tablewhite">85,107,47<br> + 556B2F </p> + </td> + <td bgcolor="lightblue" width="25%"> + <p>lightblue</p> + <p class="table">173,216,230<br> + ADD8E6 </p> + </td> + <td bgcolor="olivedrab" width="25%"> + <p><font color="#ffffff">olivedrab</font></p> + <p class="tablewhite">107,142,35<br> + 6B8E23 </p> + </td> + <td bgcolor="turquoise" width="25%"> + <p>turquoise</p> + <p class="table">64,224,208<br> + 40E0D0 </p> + </td> + </tr> + <tr> + <td bgcolor="darkorange" width="25%"> + <p>darkorange</p> + <p class="table">255,140,0<br> + FF8C00 </p> + </td> + <td bgcolor="lightcoral" width="25%"> + <p>lightcoral</p> + <p class="table">240,128,128<br> + F08080 </p> + </td> + <td bgcolor="orange" width="25%"> + <p>orange</p> + <p class="table">255,165,0<br> + FFA500 </p> + </td> + <td bgcolor="violet" width="25%"> + <p>violet</p> + <p class="table">238,130,238<br> + EE82EE </p> + </td> + </tr> + <tr> + <td bgcolor="darkorchid" width="25%"> + <p><font color="#ffffff">darkorchid</font></p> + <p class="tablewhite">153,50,204<br> + 9932CC </p> + </td> + <td bgcolor="lightcyan" width="25%"> + <p>lightcyan</p> + <p class="table">224,255,255<br> + E0FFFF</p> + </td> + <td bgcolor="orangered" width="25%"> + <p><font color="#ffffff">orangered</font></p> + <p class="tablewhite">255,69,0<br> + FF4500 </p> + </td> + <td bgcolor="wheat" width="25%"> + <p>wheat</p> + <p class="table">245,222,179<br> + F5DEB3 </p> + </td> + </tr> + <tr> + <td bgcolor="darkred" width="25%"> + <p><font color="#ffffff">darkred</font></p> + <p class="tablewhite"><font color="#ffffff">139,0,0</font><br> + 8B0000 </p> + </td> + <td bgcolor="lightgoldenrodyellow" width="25%"> + <p>lightgoldenrodyellow</p> + <p class="table">250,250,210<br> + FAFAD2 </p> + </td> + <td bgcolor="orchid" width="25%"> + <p>orchid</p> + <p class="table">218,112,214<br> + DA70D6 </p> + </td> + <td bgcolor="white" width="25%"> + <p>white</p> + <p class="table">255,255,255<br> + FFFFFF </p> + </td> + </tr> + <tr> + <td bgcolor="darksalmon" width="25%"> + <p>darksalmon</p> + <p class="table">233,150,122<br> + E9967A </p> + </td> + <td bgcolor="lightgreen" width="25%"> + <p>lightgreen</p> + <p class="table">144,238,144<br> + 90EE90 </p> + </td> + <td bgcolor="palegoldenrod" width="25%"> + <p>palegoldenrod</p> + <p class="table">238,232,170<br> + EEE8AA </p> + </td> + <td bgcolor="whitesmoke" width="25%"> + <p>whitesmoke</p> + <p class="table">245,245,245<br> + F5F5F5 </p> + </td> + </tr> + <tr> + <td bgcolor="darkseagreen" width="25%"> + <p>darkseagreen</p> + <p class="table">143,188,143<br> + 8FBC8F </p> + </td> + <td bgcolor="lightgrey" width="25%"> + <p>lightgrey</p> + <p class="table">211,211,211<br> + D3D3D3 </p> + </td> + <td bgcolor="palegreen" width="25%"> + <p>palegreen</p> + <p class="table">152,251,152<br> + 98FB98 </p> + </td> + <td bgcolor="yellow" width="25%"> + <p>yellow</p> + <p class="table">255,255,0<br> + FFFF00 </p> + </td> + </tr> + <tr> + <td bgcolor="darkslateblue" width="25%"> + <p><font color="#ffffff">darkslateblue</font></p> + <p class="tablewhite">72,61,139<br> + 483D8B </p> + </td> + <td bgcolor="lightpink" width="25%"> + <p>lightpink</p> + <p class="table">255,182,193<br> + FFB6C1 </p> + </td> + <td bgcolor="paleturquoise" width="25%"> + <p>paleturquoise</p> + <p class="table">175,238,238<br> + AFEEEE</p> + </td> + <td bgcolor="yellowgreen" width="25%"> + <p>yellowgreen</p> + <p class="table">154,205,50<br> + 9ACD32 </p> + </td> + </tr> + + <tr><td colspan="4">extras</td></tr> + <tr> + <td bgcolor="#e0e0e0" width="25%"> + <p>darkwhite</p> + <p class="table">224,224,224<br> + E0E0E0 </p> + </td> + <td bgcolor="lightpink" width="25%"> + <p>lightpink</p> + <p class="table">255,182,193<br> + FFB6C1 </p> + </td> + <td bgcolor="paleturquoise" width="25%"> + <p>paleturquoise</p> + <p class="table">175,238,238<br> + AFEEEE</p> + </td> + <td bgcolor="yellowgreen" width="25%"> + <p>yellowgreen</p> + <p class="table">154,205,50<br> + 9ACD32 </p> + </td> + </tr> + +</tbody></table> +</p><p> +<table border="0" width="90%"> +<tbody><tr> +<td colspan=""> + +<!-- O'Reilly Footer Begins Here --> + +<center> +<a href="#top">Back to top</a><p> +</p><hr noshade="noshade" size="1"> +<font face="Verdana, Arial, Helvetica" size="1"> +<a href="http://www.oreilly.com/"> +<b>oreilly.com Home</b></a> <b> | </b> +<a href="http://www.oreilly.com/sales/bookstores"> +<b>O'Reilly Bookstores</b></a> <b> | </b> +<a href="http://www.oreilly.com/order_new/"> +<b>How to Order</b></a> <b> | </b> +<a href="http://www.oreilly.com/oreilly/contact.html"> +<b>O'Reilly Contacts<br></b></a> +<a href="http://www.oreilly.com/international/"> +<b>International</b></a> <b> | </b> +<a href="http://www.oreilly.com/about.html"> +<b>About O'Reilly</b></a> <b> | </b> +<a href="http://www.oreilly.com/affiliates.html"> +<b>Affiliated Companies</b></a> <b> | </b> +<a href="http://www.oreilly.com/privacy_policy.html"> +<b>Privacy Policy</b></a></font><p> +<font face="Verdana, Arial, Helvetica" size="1"><em>© 2001, O'Reilly & Associates, Inc.</em> +</font> +</p></center> + +<!-- O'Reilly Footer Ends Here --> + +</td> +</tr> +</tbody></table> + +</p></body></html> diff --git a/docs/colors/html40colors.txt b/docs/colors/html40colors.txt new file mode 100644 index 00000000..3eeb0a10 --- /dev/null +++ b/docs/colors/html40colors.txt @@ -0,0 +1,17 @@ +# HTML 4.0 color names +Black #000000 +Silver #c0c0c0 +Gray #808080 +White #ffffff +Maroon #800000 +Red #ff0000 +Purple #800080 +Fuchsia #ff00ff +Green #008000 +Lime #00ff00 +Olive #808000 +Yellow #ffff00 +Navy #000080 +Blue #0000ff +Teal #008080 +Aqua #00ffff diff --git a/docs/colors/namedcolors.txt b/docs/colors/namedcolors.txt new file mode 100644 index 00000000..3658e85f --- /dev/null +++ b/docs/colors/namedcolors.txt @@ -0,0 +1,100 @@ +# named colors from http://www.lightlink.com/xine/bells/namedcolors.html +White #FFFFFF +Red #FF0000 +Green #00FF00 +Blue #0000FF +Magenta #FF00FF +Cyan #00FFFF +Yellow #FFFF00 +Black #000000 +Aquamarine #70DB93 +Baker's Chocolate #5C3317 +Blue Violet #9F5F9F +Brass #B5A642 +Bright Gold #D9D919 +Brown #A62A2A +Bronze #8C7853 +Bronze II #A67D3D +Cadet Blue #5F9F9F +Cool Copper #D98719 +Copper #B87333 +Coral #FF7F00 +Corn Flower Blue #42426F +Dark Brown #5C4033 +Dark Green #2F4F2F +Dark Green Copper #4A766E +Dark Olive Green #4F4F2F +Dark Orchid #9932CD +Dark Purple #871F78 +Dark Slate Blue #6B238E +Dark Slate Grey #2F4F4F +Dark Tan #97694F +Dark Turquoise #7093DB +Dark Wood #855E42 +Dim Grey #545454 +Dusty Rose #856363 +Feldspar #D19275 +Firebrick #8E2323 +Forest Green #238E23 +Gold #CD7F32 +Goldenrod #DBDB70 +Grey #C0C0C0 +Green Copper #527F76 +Green Yellow #93DB70 +Hunter Green #215E21 +Indian Red #4E2F2F +Khaki #9F9F5F +Light Blue #C0D9D9 +Light Grey #A8A8A8 +Light Steel Blue #8F8FBD +Light Wood #E9C2A6 +Lime Green #32CD32 +Mandarian Orange #E47833 +Maroon #8E236B +Medium Aquamarine #32CD99 +Medium Blue #3232CD +Medium Forest Green #6B8E23 +Medium Goldenrod #EAEAAE +Medium Orchid #9370DB +Medium Sea Green #426F42 +Medium Slate Blue #7F00FF +Medium Spring Green #7FFF00 +Medium Turquoise #70DBDB +Medium Violet Red #DB7093 +Medium Wood #A68064 +Midnight Blue #2F2F4F +Navy Blue #23238E +Neon Blue #4D4DFF +Neon Pink #FF6EC7 +New Midnight Blue #00009C +New Tan #EBC79E +Old Gold #CFB53B +Orange #FF7F00 +Orange Red #FF2400 +Orchid #DB70DB +Pale Green #8FBC8F +Pink #BC8F8F +Plum #EAADEA +Quartz #D9D9F3 +Rich Blue #5959AB +Salmon #6F4242 +Scarlet #8C1717 +Sea Green #238E68 +Semi-Sweet Chocolate #6B4226 +Sienna #8E6B23 +Silver #E6E8FA +Sky Blue #3299CC +Slate Blue #007FFF +Spicy Pink #FF1CAE +Spring Green #00FF7F +Steel Blue #236B8E +Summer Sky #38B0DE +Tan #DB9370 +Thistle #D8BFD8 +Turquoise #ADEAEA +Very Dark Brown #5C4033 +Very Light Grey #CDCDCD +Violet #4F2F4F +Violet Red #CC3299 +Wheat #D8D8BF +Yellow Green #99CC32 diff --git a/docs/colors/rgb.txt b/docs/colors/rgb.txt new file mode 100644 index 00000000..62eb8961 --- /dev/null +++ b/docs/colors/rgb.txt @@ -0,0 +1,753 @@ +! $Xorg: rgb.txt,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ +255 250 250 snow +248 248 255 ghost white +248 248 255 GhostWhite +245 245 245 white smoke +245 245 245 WhiteSmoke +220 220 220 gainsboro +255 250 240 floral white +255 250 240 FloralWhite +253 245 230 old lace +253 245 230 OldLace +250 240 230 linen +250 235 215 antique white +250 235 215 AntiqueWhite +255 239 213 papaya whip +255 239 213 PapayaWhip +255 235 205 blanched almond +255 235 205 BlanchedAlmond +255 228 196 bisque +255 218 185 peach puff +255 218 185 PeachPuff +255 222 173 navajo white +255 222 173 NavajoWhite +255 228 181 moccasin +255 248 220 cornsilk +255 255 240 ivory +255 250 205 lemon chiffon +255 250 205 LemonChiffon +255 245 238 seashell +240 255 240 honeydew +245 255 250 mint cream +245 255 250 MintCream +240 255 255 azure +240 248 255 alice blue +240 248 255 AliceBlue +230 230 250 lavender +255 240 245 lavender blush +255 240 245 LavenderBlush +255 228 225 misty rose +255 228 225 MistyRose +255 255 255 white + 0 0 0 black + 47 79 79 dark slate gray + 47 79 79 DarkSlateGray + 47 79 79 dark slate grey + 47 79 79 DarkSlateGrey +105 105 105 dim gray +105 105 105 DimGray +105 105 105 dim grey +105 105 105 DimGrey +112 128 144 slate gray +112 128 144 SlateGray +112 128 144 slate grey +112 128 144 SlateGrey +119 136 153 light slate gray +119 136 153 LightSlateGray +119 136 153 light slate grey +119 136 153 LightSlateGrey +190 190 190 gray +190 190 190 grey +211 211 211 light grey +211 211 211 LightGrey +211 211 211 light gray +211 211 211 LightGray + 25 25 112 midnight blue + 25 25 112 MidnightBlue + 0 0 128 navy + 0 0 128 navy blue + 0 0 128 NavyBlue +100 149 237 cornflower blue +100 149 237 CornflowerBlue + 72 61 139 dark slate blue + 72 61 139 DarkSlateBlue +106 90 205 slate blue +106 90 205 SlateBlue +123 104 238 medium slate blue +123 104 238 MediumSlateBlue +132 112 255 light slate blue +132 112 255 LightSlateBlue + 0 0 205 medium blue + 0 0 205 MediumBlue + 65 105 225 royal blue + 65 105 225 RoyalBlue + 0 0 255 blue + 30 144 255 dodger blue + 30 144 255 DodgerBlue + 0 191 255 deep sky blue + 0 191 255 DeepSkyBlue +135 206 235 sky blue +135 206 235 SkyBlue +135 206 250 light sky blue +135 206 250 LightSkyBlue + 70 130 180 steel blue + 70 130 180 SteelBlue +176 196 222 light steel blue +176 196 222 LightSteelBlue +173 216 230 light blue +173 216 230 LightBlue +176 224 230 powder blue +176 224 230 PowderBlue +175 238 238 pale turquoise +175 238 238 PaleTurquoise + 0 206 209 dark turquoise + 0 206 209 DarkTurquoise + 72 209 204 medium turquoise + 72 209 204 MediumTurquoise + 64 224 208 turquoise + 0 255 255 cyan +224 255 255 light cyan +224 255 255 LightCyan + 95 158 160 cadet blue + 95 158 160 CadetBlue +102 205 170 medium aquamarine +102 205 170 MediumAquamarine +127 255 212 aquamarine + 0 100 0 dark green + 0 100 0 DarkGreen + 85 107 47 dark olive green + 85 107 47 DarkOliveGreen +143 188 143 dark sea green +143 188 143 DarkSeaGreen + 46 139 87 sea green + 46 139 87 SeaGreen + 60 179 113 medium sea green + 60 179 113 MediumSeaGreen + 32 178 170 light sea green + 32 178 170 LightSeaGreen +152 251 152 pale green +152 251 152 PaleGreen + 0 255 127 spring green + 0 255 127 SpringGreen +124 252 0 lawn green +124 252 0 LawnGreen + 0 255 0 green +127 255 0 chartreuse + 0 250 154 medium spring green + 0 250 154 MediumSpringGreen +173 255 47 green yellow +173 255 47 GreenYellow + 50 205 50 lime green + 50 205 50 LimeGreen +154 205 50 yellow green +154 205 50 YellowGreen + 34 139 34 forest green + 34 139 34 ForestGreen +107 142 35 olive drab +107 142 35 OliveDrab +189 183 107 dark khaki +189 183 107 DarkKhaki +240 230 140 khaki +238 232 170 pale goldenrod +238 232 170 PaleGoldenrod +250 250 210 light goldenrod yellow +250 250 210 LightGoldenrodYellow +255 255 224 light yellow +255 255 224 LightYellow +255 255 0 yellow +255 215 0 gold +238 221 130 light goldenrod +238 221 130 LightGoldenrod +218 165 32 goldenrod +184 134 11 dark goldenrod +184 134 11 DarkGoldenrod +188 143 143 rosy brown +188 143 143 RosyBrown +205 92 92 indian red +205 92 92 IndianRed +139 69 19 saddle brown +139 69 19 SaddleBrown +160 82 45 sienna +205 133 63 peru +222 184 135 burlywood +245 245 220 beige +245 222 179 wheat +244 164 96 sandy brown +244 164 96 SandyBrown +210 180 140 tan +210 105 30 chocolate +178 34 34 firebrick +165 42 42 brown +233 150 122 dark salmon +233 150 122 DarkSalmon +250 128 114 salmon +255 160 122 light salmon +255 160 122 LightSalmon +255 165 0 orange +255 140 0 dark orange +255 140 0 DarkOrange +255 127 80 coral +240 128 128 light coral +240 128 128 LightCoral +255 99 71 tomato +255 69 0 orange red +255 69 0 OrangeRed +255 0 0 red +255 105 180 hot pink +255 105 180 HotPink +255 20 147 deep pink +255 20 147 DeepPink +255 192 203 pink +255 182 193 light pink +255 182 193 LightPink +219 112 147 pale violet red +219 112 147 PaleVioletRed +176 48 96 maroon +199 21 133 medium violet red +199 21 133 MediumVioletRed +208 32 144 violet red +208 32 144 VioletRed +255 0 255 magenta +238 130 238 violet +221 160 221 plum +218 112 214 orchid +186 85 211 medium orchid +186 85 211 MediumOrchid +153 50 204 dark orchid +153 50 204 DarkOrchid +148 0 211 dark violet +148 0 211 DarkViolet +138 43 226 blue violet +138 43 226 BlueViolet +160 32 240 purple +147 112 219 medium purple +147 112 219 MediumPurple +216 191 216 thistle +255 250 250 snow1 +238 233 233 snow2 +205 201 201 snow3 +139 137 137 snow4 +255 245 238 seashell1 +238 229 222 seashell2 +205 197 191 seashell3 +139 134 130 seashell4 +255 239 219 AntiqueWhite1 +238 223 204 AntiqueWhite2 +205 192 176 AntiqueWhite3 +139 131 120 AntiqueWhite4 +255 228 196 bisque1 +238 213 183 bisque2 +205 183 158 bisque3 +139 125 107 bisque4 +255 218 185 PeachPuff1 +238 203 173 PeachPuff2 +205 175 149 PeachPuff3 +139 119 101 PeachPuff4 +255 222 173 NavajoWhite1 +238 207 161 NavajoWhite2 +205 179 139 NavajoWhite3 +139 121 94 NavajoWhite4 +255 250 205 LemonChiffon1 +238 233 191 LemonChiffon2 +205 201 165 LemonChiffon3 +139 137 112 LemonChiffon4 +255 248 220 cornsilk1 +238 232 205 cornsilk2 +205 200 177 cornsilk3 +139 136 120 cornsilk4 +255 255 240 ivory1 +238 238 224 ivory2 +205 205 193 ivory3 +139 139 131 ivory4 +240 255 240 honeydew1 +224 238 224 honeydew2 +193 205 193 honeydew3 +131 139 131 honeydew4 +255 240 245 LavenderBlush1 +238 224 229 LavenderBlush2 +205 193 197 LavenderBlush3 +139 131 134 LavenderBlush4 +255 228 225 MistyRose1 +238 213 210 MistyRose2 +205 183 181 MistyRose3 +139 125 123 MistyRose4 +240 255 255 azure1 +224 238 238 azure2 +193 205 205 azure3 +131 139 139 azure4 +131 111 255 SlateBlue1 +122 103 238 SlateBlue2 +105 89 205 SlateBlue3 + 71 60 139 SlateBlue4 + 72 118 255 RoyalBlue1 + 67 110 238 RoyalBlue2 + 58 95 205 RoyalBlue3 + 39 64 139 RoyalBlue4 + 0 0 255 blue1 + 0 0 238 blue2 + 0 0 205 blue3 + 0 0 139 blue4 + 30 144 255 DodgerBlue1 + 28 134 238 DodgerBlue2 + 24 116 205 DodgerBlue3 + 16 78 139 DodgerBlue4 + 99 184 255 SteelBlue1 + 92 172 238 SteelBlue2 + 79 148 205 SteelBlue3 + 54 100 139 SteelBlue4 + 0 191 255 DeepSkyBlue1 + 0 178 238 DeepSkyBlue2 + 0 154 205 DeepSkyBlue3 + 0 104 139 DeepSkyBlue4 +135 206 255 SkyBlue1 +126 192 238 SkyBlue2 +108 166 205 SkyBlue3 + 74 112 139 SkyBlue4 +176 226 255 LightSkyBlue1 +164 211 238 LightSkyBlue2 +141 182 205 LightSkyBlue3 + 96 123 139 LightSkyBlue4 +198 226 255 SlateGray1 +185 211 238 SlateGray2 +159 182 205 SlateGray3 +108 123 139 SlateGray4 +202 225 255 LightSteelBlue1 +188 210 238 LightSteelBlue2 +162 181 205 LightSteelBlue3 +110 123 139 LightSteelBlue4 +191 239 255 LightBlue1 +178 223 238 LightBlue2 +154 192 205 LightBlue3 +104 131 139 LightBlue4 +224 255 255 LightCyan1 +209 238 238 LightCyan2 +180 205 205 LightCyan3 +122 139 139 LightCyan4 +187 255 255 PaleTurquoise1 +174 238 238 PaleTurquoise2 +150 205 205 PaleTurquoise3 +102 139 139 PaleTurquoise4 +152 245 255 CadetBlue1 +142 229 238 CadetBlue2 +122 197 205 CadetBlue3 + 83 134 139 CadetBlue4 + 0 245 255 turquoise1 + 0 229 238 turquoise2 + 0 197 205 turquoise3 + 0 134 139 turquoise4 + 0 255 255 cyan1 + 0 238 238 cyan2 + 0 205 205 cyan3 + 0 139 139 cyan4 +151 255 255 DarkSlateGray1 +141 238 238 DarkSlateGray2 +121 205 205 DarkSlateGray3 + 82 139 139 DarkSlateGray4 +127 255 212 aquamarine1 +118 238 198 aquamarine2 +102 205 170 aquamarine3 + 69 139 116 aquamarine4 +193 255 193 DarkSeaGreen1 +180 238 180 DarkSeaGreen2 +155 205 155 DarkSeaGreen3 +105 139 105 DarkSeaGreen4 + 84 255 159 SeaGreen1 + 78 238 148 SeaGreen2 + 67 205 128 SeaGreen3 + 46 139 87 SeaGreen4 +154 255 154 PaleGreen1 +144 238 144 PaleGreen2 +124 205 124 PaleGreen3 + 84 139 84 PaleGreen4 + 0 255 127 SpringGreen1 + 0 238 118 SpringGreen2 + 0 205 102 SpringGreen3 + 0 139 69 SpringGreen4 + 0 255 0 green1 + 0 238 0 green2 + 0 205 0 green3 + 0 139 0 green4 +127 255 0 chartreuse1 +118 238 0 chartreuse2 +102 205 0 chartreuse3 + 69 139 0 chartreuse4 +192 255 62 OliveDrab1 +179 238 58 OliveDrab2 +154 205 50 OliveDrab3 +105 139 34 OliveDrab4 +202 255 112 DarkOliveGreen1 +188 238 104 DarkOliveGreen2 +162 205 90 DarkOliveGreen3 +110 139 61 DarkOliveGreen4 +255 246 143 khaki1 +238 230 133 khaki2 +205 198 115 khaki3 +139 134 78 khaki4 +255 236 139 LightGoldenrod1 +238 220 130 LightGoldenrod2 +205 190 112 LightGoldenrod3 +139 129 76 LightGoldenrod4 +255 255 224 LightYellow1 +238 238 209 LightYellow2 +205 205 180 LightYellow3 +139 139 122 LightYellow4 +255 255 0 yellow1 +238 238 0 yellow2 +205 205 0 yellow3 +139 139 0 yellow4 +255 215 0 gold1 +238 201 0 gold2 +205 173 0 gold3 +139 117 0 gold4 +255 193 37 goldenrod1 +238 180 34 goldenrod2 +205 155 29 goldenrod3 +139 105 20 goldenrod4 +255 185 15 DarkGoldenrod1 +238 173 14 DarkGoldenrod2 +205 149 12 DarkGoldenrod3 +139 101 8 DarkGoldenrod4 +255 193 193 RosyBrown1 +238 180 180 RosyBrown2 +205 155 155 RosyBrown3 +139 105 105 RosyBrown4 +255 106 106 IndianRed1 +238 99 99 IndianRed2 +205 85 85 IndianRed3 +139 58 58 IndianRed4 +255 130 71 sienna1 +238 121 66 sienna2 +205 104 57 sienna3 +139 71 38 sienna4 +255 211 155 burlywood1 +238 197 145 burlywood2 +205 170 125 burlywood3 +139 115 85 burlywood4 +255 231 186 wheat1 +238 216 174 wheat2 +205 186 150 wheat3 +139 126 102 wheat4 +255 165 79 tan1 +238 154 73 tan2 +205 133 63 tan3 +139 90 43 tan4 +255 127 36 chocolate1 +238 118 33 chocolate2 +205 102 29 chocolate3 +139 69 19 chocolate4 +255 48 48 firebrick1 +238 44 44 firebrick2 +205 38 38 firebrick3 +139 26 26 firebrick4 +255 64 64 brown1 +238 59 59 brown2 +205 51 51 brown3 +139 35 35 brown4 +255 140 105 salmon1 +238 130 98 salmon2 +205 112 84 salmon3 +139 76 57 salmon4 +255 160 122 LightSalmon1 +238 149 114 LightSalmon2 +205 129 98 LightSalmon3 +139 87 66 LightSalmon4 +255 165 0 orange1 +238 154 0 orange2 +205 133 0 orange3 +139 90 0 orange4 +255 127 0 DarkOrange1 +238 118 0 DarkOrange2 +205 102 0 DarkOrange3 +139 69 0 DarkOrange4 +255 114 86 coral1 +238 106 80 coral2 +205 91 69 coral3 +139 62 47 coral4 +255 99 71 tomato1 +238 92 66 tomato2 +205 79 57 tomato3 +139 54 38 tomato4 +255 69 0 OrangeRed1 +238 64 0 OrangeRed2 +205 55 0 OrangeRed3 +139 37 0 OrangeRed4 +255 0 0 red1 +238 0 0 red2 +205 0 0 red3 +139 0 0 red4 +255 20 147 DeepPink1 +238 18 137 DeepPink2 +205 16 118 DeepPink3 +139 10 80 DeepPink4 +255 110 180 HotPink1 +238 106 167 HotPink2 +205 96 144 HotPink3 +139 58 98 HotPink4 +255 181 197 pink1 +238 169 184 pink2 +205 145 158 pink3 +139 99 108 pink4 +255 174 185 LightPink1 +238 162 173 LightPink2 +205 140 149 LightPink3 +139 95 101 LightPink4 +255 130 171 PaleVioletRed1 +238 121 159 PaleVioletRed2 +205 104 137 PaleVioletRed3 +139 71 93 PaleVioletRed4 +255 52 179 maroon1 +238 48 167 maroon2 +205 41 144 maroon3 +139 28 98 maroon4 +255 62 150 VioletRed1 +238 58 140 VioletRed2 +205 50 120 VioletRed3 +139 34 82 VioletRed4 +255 0 255 magenta1 +238 0 238 magenta2 +205 0 205 magenta3 +139 0 139 magenta4 +255 131 250 orchid1 +238 122 233 orchid2 +205 105 201 orchid3 +139 71 137 orchid4 +255 187 255 plum1 +238 174 238 plum2 +205 150 205 plum3 +139 102 139 plum4 +224 102 255 MediumOrchid1 +209 95 238 MediumOrchid2 +180 82 205 MediumOrchid3 +122 55 139 MediumOrchid4 +191 62 255 DarkOrchid1 +178 58 238 DarkOrchid2 +154 50 205 DarkOrchid3 +104 34 139 DarkOrchid4 +155 48 255 purple1 +145 44 238 purple2 +125 38 205 purple3 + 85 26 139 purple4 +171 130 255 MediumPurple1 +159 121 238 MediumPurple2 +137 104 205 MediumPurple3 + 93 71 139 MediumPurple4 +255 225 255 thistle1 +238 210 238 thistle2 +205 181 205 thistle3 +139 123 139 thistle4 + 0 0 0 gray0 + 0 0 0 grey0 + 3 3 3 gray1 + 3 3 3 grey1 + 5 5 5 gray2 + 5 5 5 grey2 + 8 8 8 gray3 + 8 8 8 grey3 + 10 10 10 gray4 + 10 10 10 grey4 + 13 13 13 gray5 + 13 13 13 grey5 + 15 15 15 gray6 + 15 15 15 grey6 + 18 18 18 gray7 + 18 18 18 grey7 + 20 20 20 gray8 + 20 20 20 grey8 + 23 23 23 gray9 + 23 23 23 grey9 + 26 26 26 gray10 + 26 26 26 grey10 + 28 28 28 gray11 + 28 28 28 grey11 + 31 31 31 gray12 + 31 31 31 grey12 + 33 33 33 gray13 + 33 33 33 grey13 + 36 36 36 gray14 + 36 36 36 grey14 + 38 38 38 gray15 + 38 38 38 grey15 + 41 41 41 gray16 + 41 41 41 grey16 + 43 43 43 gray17 + 43 43 43 grey17 + 46 46 46 gray18 + 46 46 46 grey18 + 48 48 48 gray19 + 48 48 48 grey19 + 51 51 51 gray20 + 51 51 51 grey20 + 54 54 54 gray21 + 54 54 54 grey21 + 56 56 56 gray22 + 56 56 56 grey22 + 59 59 59 gray23 + 59 59 59 grey23 + 61 61 61 gray24 + 61 61 61 grey24 + 64 64 64 gray25 + 64 64 64 grey25 + 66 66 66 gray26 + 66 66 66 grey26 + 69 69 69 gray27 + 69 69 69 grey27 + 71 71 71 gray28 + 71 71 71 grey28 + 74 74 74 gray29 + 74 74 74 grey29 + 77 77 77 gray30 + 77 77 77 grey30 + 79 79 79 gray31 + 79 79 79 grey31 + 82 82 82 gray32 + 82 82 82 grey32 + 84 84 84 gray33 + 84 84 84 grey33 + 87 87 87 gray34 + 87 87 87 grey34 + 89 89 89 gray35 + 89 89 89 grey35 + 92 92 92 gray36 + 92 92 92 grey36 + 94 94 94 gray37 + 94 94 94 grey37 + 97 97 97 gray38 + 97 97 97 grey38 + 99 99 99 gray39 + 99 99 99 grey39 +102 102 102 gray40 +102 102 102 grey40 +105 105 105 gray41 +105 105 105 grey41 +107 107 107 gray42 +107 107 107 grey42 +110 110 110 gray43 +110 110 110 grey43 +112 112 112 gray44 +112 112 112 grey44 +115 115 115 gray45 +115 115 115 grey45 +117 117 117 gray46 +117 117 117 grey46 +120 120 120 gray47 +120 120 120 grey47 +122 122 122 gray48 +122 122 122 grey48 +125 125 125 gray49 +125 125 125 grey49 +127 127 127 gray50 +127 127 127 grey50 +130 130 130 gray51 +130 130 130 grey51 +133 133 133 gray52 +133 133 133 grey52 +135 135 135 gray53 +135 135 135 grey53 +138 138 138 gray54 +138 138 138 grey54 +140 140 140 gray55 +140 140 140 grey55 +143 143 143 gray56 +143 143 143 grey56 +145 145 145 gray57 +145 145 145 grey57 +148 148 148 gray58 +148 148 148 grey58 +150 150 150 gray59 +150 150 150 grey59 +153 153 153 gray60 +153 153 153 grey60 +156 156 156 gray61 +156 156 156 grey61 +158 158 158 gray62 +158 158 158 grey62 +161 161 161 gray63 +161 161 161 grey63 +163 163 163 gray64 +163 163 163 grey64 +166 166 166 gray65 +166 166 166 grey65 +168 168 168 gray66 +168 168 168 grey66 +171 171 171 gray67 +171 171 171 grey67 +173 173 173 gray68 +173 173 173 grey68 +176 176 176 gray69 +176 176 176 grey69 +179 179 179 gray70 +179 179 179 grey70 +181 181 181 gray71 +181 181 181 grey71 +184 184 184 gray72 +184 184 184 grey72 +186 186 186 gray73 +186 186 186 grey73 +189 189 189 gray74 +189 189 189 grey74 +191 191 191 gray75 +191 191 191 grey75 +194 194 194 gray76 +194 194 194 grey76 +196 196 196 gray77 +196 196 196 grey77 +199 199 199 gray78 +199 199 199 grey78 +201 201 201 gray79 +201 201 201 grey79 +204 204 204 gray80 +204 204 204 grey80 +207 207 207 gray81 +207 207 207 grey81 +209 209 209 gray82 +209 209 209 grey82 +212 212 212 gray83 +212 212 212 grey83 +214 214 214 gray84 +214 214 214 grey84 +217 217 217 gray85 +217 217 217 grey85 +219 219 219 gray86 +219 219 219 grey86 +222 222 222 gray87 +222 222 222 grey87 +224 224 224 gray88 +224 224 224 grey88 +227 227 227 gray89 +227 227 227 grey89 +229 229 229 gray90 +229 229 229 grey90 +232 232 232 gray91 +232 232 232 grey91 +235 235 235 gray92 +235 235 235 grey92 +237 237 237 gray93 +237 237 237 grey93 +240 240 240 gray94 +240 240 240 grey94 +242 242 242 gray95 +242 242 242 grey95 +245 245 245 gray96 +245 245 245 grey96 +247 247 247 gray97 +247 247 247 grey97 +250 250 250 gray98 +250 250 250 grey98 +252 252 252 gray99 +252 252 252 grey99 +255 255 255 gray100 +255 255 255 grey100 +169 169 169 dark grey +169 169 169 DarkGrey +169 169 169 dark gray +169 169 169 DarkGray +0 0 139 dark blue +0 0 139 DarkBlue +0 139 139 dark cyan +0 139 139 DarkCyan +139 0 139 dark magenta +139 0 139 DarkMagenta +139 0 0 dark red +139 0 0 DarkRed +144 238 144 light green +144 238 144 LightGreen diff --git a/docs/colors/webcolors.txt b/docs/colors/webcolors.txt new file mode 100644 index 00000000..f645c1e6 --- /dev/null +++ b/docs/colors/webcolors.txt @@ -0,0 +1,141 @@ +# De-facto NS & MSIE recognized HTML color names +AliceBlue #f0f8ff +AntiqueWhite #faebd7 +Aqua #00ffff +Aquamarine #7fffd4 +Azure #f0ffff +Beige #f5f5dc +Bisque #ffe4c4 +Black #000000 +BlanchedAlmond #ffebcd +Blue #0000ff +BlueViolet #8a2be2 +Brown #a52a2a +BurlyWood #deb887 +CadetBlue #5f9ea0 +Chartreuse #7fff00 +Chocolate #d2691e +Coral #ff7f50 +CornflowerBlue #6495ed +Cornsilk #fff8dc +Crimson #dc143c +Cyan #00ffff +DarkBlue #00008b +DarkCyan #008b8b +DarkGoldenrod #b8860b +DarkGray #a9a9a9 +DarkGreen #006400 +DarkKhaki #bdb76b +DarkMagenta #8b008b +DarkOliveGreen #556b2f +DarkOrange #ff8c00 +DarkOrchid #9932cc +DarkRed #8b0000 +DarkSalmon #e9967a +DarkSeaGreen #8fbc8f +DarkSlateBlue #483d8b +DarkSlateGray #2f4f4f +DarkTurquoise #00ced1 +DarkViolet #9400d3 +DeepPink #ff1493 +DeepSkyBlue #00bfff +DimGray #696969 +DodgerBlue #1e90ff +FireBrick #b22222 +FloralWhite #fffaf0 +ForestGreen #228b22 +Fuchsia #ff00ff +Gainsboro #dcdcdc +GhostWhite #f8f8ff +Gold #ffd700 +Goldenrod #daa520 +Gray #808080 +Green #008000 +GreenYellow #adff2f +Honeydew #f0fff0 +HotPink #ff69b4 +IndianRed #cd5c5c +Indigo #4b0082 +Ivory #fffff0 +Khaki #f0e68c +Lavender #e6e6fa +LavenderBlush #fff0f5 +LawnGreen #7cfc00 +LemonChiffon #fffacd +LightBlue #add8e6 +LightCoral #f08080 +LightCyan #e0ffff +LightGoldenrodYellow #fafad2 +LightGreen #90ee90 +LightGrey #d3d3d3 +LightPink #ffb6c1 +LightSalmon #ffa07a +LightSeaGreen #20b2aa +LightSkyBlue #87cefa +LightSlateGray #778899 +LightSteelBlue #b0c4de +LightYellow #ffffe0 +Lime #00ff00 +LimeGreen #32cd32 +Linen #faf0e6 +Magenta #ff00ff +Maroon #800000 +MediumAquamarine #66cdaa +MediumBlue #0000cd +MediumOrchid #ba55d3 +MediumPurple #9370db +MediumSeaGreen #3cb371 +MediumSlateBlue #7b68ee +MediumSpringGreen #00fa9a +MediumTurquoise #48d1cc +MediumVioletRed #c71585 +MidnightBlue #191970 +MintCream #f5fffa +MistyRose #ffe4e1 +Moccasin #ffe4b5 +NavajoWhite #ffdead +Navy #000080 +OldLace #fdf5e6 +Olive #808000 +OliveDrab #6b8e23 +Orange #ffa500 +OrangeRed #ff4500 +Orchid #da70d6 +PaleGoldenrod #eee8aa +PaleGreen #98fb98 +PaleTurquoise #afeeee +PaleVioletRed #db7093 +PapayaWhip #ffefd5 +PeachPuff #ffdab9 +Peru #cd853f +Pink #ffc0cb +Plum #dda0dd +PowderBlue #b0e0e6 +Purple #800080 +Red #ff0000 +RosyBrown #bc8f8f +RoyalBlue #4169e1 +SaddleBrown #8b4513 +Salmon #fa8072 +SandyBrown #f4a460 +SeaGreen #2e8b57 +Seashell #fff5ee +Sienna #a0522d +Silver #c0c0c0 +SkyBlue #87ceeb +SlateBlue #6a5acd +SlateGray #708090 +Snow #fffafa +SpringGreen #00ff7f +SteelBlue #4682b4 +Tan #d2b48c +Teal #008080 +Thistle #d8bfd8 +Tomato #ff6347 +Turquoise #40e0d0 +Violet #ee82ee +Wheat #f5deb3 +White #ffffff +WhiteSmoke #f5f5f5 +Yellow #ffff00 +YellowGreen #9acd32 diff --git a/docs/colors/websafe.txt b/docs/colors/websafe.txt new file mode 100644 index 00000000..70ed51e6 --- /dev/null +++ b/docs/colors/websafe.txt @@ -0,0 +1,217 @@ +# Websafe RGB values +#000000 +#000033 +#000066 +#000099 +#0000cc +#0000ff +#003300 +#003333 +#003366 +#003399 +#0033cc +#0033ff +#006600 +#006633 +#006666 +#006699 +#0066cc +#0066ff +#009900 +#009933 +#009966 +#009999 +#0099cc +#0099ff +#00cc00 +#00cc33 +#00cc66 +#00cc99 +#00cccc +#00ccff +#00ff00 +#00ff33 +#00ff66 +#00ff99 +#00ffcc +#00ffff +#330000 +#330033 +#330066 +#330099 +#3300cc +#3300ff +#333300 +#333333 +#333366 +#333399 +#3333cc +#3333ff +#336600 +#336633 +#336666 +#336699 +#3366cc +#3366ff +#339900 +#339933 +#339966 +#339999 +#3399cc +#3399ff +#33cc00 +#33cc33 +#33cc66 +#33cc99 +#33cccc +#33ccff +#33ff00 +#33ff33 +#33ff66 +#33ff99 +#33ffcc +#33ffff +#660000 +#660033 +#660066 +#660099 +#6600cc +#6600ff +#663300 +#663333 +#663366 +#663399 +#6633cc +#6633ff +#666600 +#666633 +#666666 +#666699 +#6666cc +#6666ff +#669900 +#669933 +#669966 +#669999 +#6699cc +#6699ff +#66cc00 +#66cc33 +#66cc66 +#66cc99 +#66cccc +#66ccff +#66ff00 +#66ff33 +#66ff66 +#66ff99 +#66ffcc +#66ffff +#990000 +#990033 +#990066 +#990099 +#9900cc +#9900ff +#993300 +#993333 +#993366 +#993399 +#9933cc +#9933ff +#996600 +#996633 +#996666 +#996699 +#9966cc +#9966ff +#999900 +#999933 +#999966 +#999999 +#9999cc +#9999ff +#99cc00 +#99cc33 +#99cc66 +#99cc99 +#99cccc +#99ccff +#99ff00 +#99ff33 +#99ff66 +#99ff99 +#99ffcc +#99ffff +#cc0000 +#cc0033 +#cc0066 +#cc0099 +#cc00cc +#cc00ff +#cc3300 +#cc3333 +#cc3366 +#cc3399 +#cc33cc +#cc33ff +#cc6600 +#cc6633 +#cc6666 +#cc6699 +#cc66cc +#cc66ff +#cc9900 +#cc9933 +#cc9966 +#cc9999 +#cc99cc +#cc99ff +#cccc00 +#cccc33 +#cccc66 +#cccc99 +#cccccc +#ccccff +#ccff00 +#ccff33 +#ccff66 +#ccff99 +#ccffcc +#ccffff +#ff0000 +#ff0033 +#ff0066 +#ff0099 +#ff00cc +#ff00ff +#ff3300 +#ff3333 +#ff3366 +#ff3399 +#ff33cc +#ff33ff +#ff6600 +#ff6633 +#ff6666 +#ff6699 +#ff66cc +#ff66ff +#ff9900 +#ff9933 +#ff9966 +#ff9999 +#ff99cc +#ff99ff +#ffcc00 +#ffcc33 +#ffcc66 +#ffcc99 +#ffcccc +#ffccff +#ffff00 +#ffff33 +#ffff66 +#ffff99 +#ffffcc +#ffffff diff --git a/docs/fpGUIHelpIntegration.lpk b/docs/fpGUIHelpIntegration.lpk new file mode 100644 index 00000000..7d02a4e4 --- /dev/null +++ b/docs/fpGUIHelpIntegration.lpk @@ -0,0 +1,53 @@ +<?xml version="1.0"?> +<CONFIG> + <Package Version="2"> + <Name Value="fpGUIHelpIntegration"/> + <Author Value="Graeme Geldenhuys"/> + <CompilerOptions> + <Version Value="5"/> + <SearchPaths> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <AllowLabel Value="False"/> + </SyntaxOptions> + </Parsing> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Description Value="fpGUI Help Integration +"/> + <License Value="LGPL +"/> + <Version Minor="3"/> + <Files Count="1"> + <Item1> + <Filename Value="pkghelpfpGUI.pas"/> + <HasRegisterProc Value="True"/> + <UnitName Value="pkghelpfpGUI"/> + </Item1> + </Files> + <Type Value="DesignTime"/> + <RequiredPkgs Count="2"> + <Item1> + <PackageName Value="IDEIntf"/> + </Item1> + <Item2> + <PackageName Value="FCL"/> + <MinVersion Major="1" Valid="True"/> + </Item2> + </RequiredPkgs> + <UsageOptions> + <UnitPath Value="$(PkgOutDir)/"/> + </UsageOptions> + <PublishOptions> + <Version Value="2"/> + <IgnoreBinaries Value="False"/> + </PublishOptions> + </Package> +</CONFIG> diff --git a/docs/fpGUIHelpIntegration.pas b/docs/fpGUIHelpIntegration.pas new file mode 100644 index 00000000..42597e4b --- /dev/null +++ b/docs/fpGUIHelpIntegration.pas @@ -0,0 +1,21 @@ +{ This file was automatically created by Lazarus. Do not edit! +This source is only used to compile and install the package. + } + +unit fpGUIHelpIntegration; + +interface + +uses + pkghelpfpGUI, LazarusPackageIntf; + +implementation + +procedure Register; +begin + RegisterUnit('pkghelpfpGUI', @pkghelpfpGUI.Register); +end; + +initialization + RegisterPackage('fpGUIHelpIntegration', @Register); +end. diff --git a/docs/fpGUIHelpIntegration.txt b/docs/fpGUIHelpIntegration.txt new file mode 100644 index 00000000..fc22a7fc --- /dev/null +++ b/docs/fpGUIHelpIntegration.txt @@ -0,0 +1,15 @@ +Setup for Integrated Help under Lazarus +--------------------------------------- + +For the Integrated Help to work, the fpGUIHelpIntegration package has been +setup to find the help in the /docs/html directory. + +Installation: +--------------- +1) Open fpGUIHelpIntegration.lpk package with Lazarus. +2) Click Compile +3) Click Install + + +Regards, + - Graeme Geldenhuys - diff --git a/docs/html/fpdoc.css b/docs/html/fpdoc.css new file mode 100644 index 00000000..5314232d --- /dev/null +++ b/docs/html/fpdoc.css @@ -0,0 +1,129 @@ +/* + $Id$ + + Default style sheet for FPDoc reference documentation + by Sebastian Guenther, sg@freepascal.org + + Feel free to use this file as a template for your own style sheets. +*/ + +body { + background: white +} + +body, p, th, td, caption, h1, h2, h3, ul, ol, dl { + color: black; + font-family: sans-serif +} + +tt, span.kw, pre { + font-family: monospace, Courier +} + +body, p, th, td, caption, ul, ol, dl, tt, span.kw, pre { + font-size: 14px +} + +A:link { + color: blue +} + +A:visited { + color: darkblue +} + +A:active { + color: red +} + +A { + text-decoration: none +} + +A:hover { + text-decoration: underline +} + +h1, h2, td.h2 { + color: #005A9C +} + +/* Especially for Netscape on Linux: */ +h3, td.h3 { + font-size: 12pt +} + +/* symbols in source fragments */ +span.sym { + color: darkred +} + +/* keywords in source fragments */ +span.kw { + font-weight: bold +} + +/* comments in source fragments */ +span.cmt { + color: darkcyan; + font-style: italic +} + +/* directives in source fragments */ +span.dir { + color: darkyellow; + font-style: italic +} + +/* numbers in source fragments */ +span.num { + color: darkmagenta +} + +/* characters (#...) in source fragments */ +span.chr { + color: darkcyan +} + +/* strings in source fragments */ +span.str { + color: blue +} + +/* assembler passages in source fragments */ +span.asm { + color: green +} + + +td.pre { + white-space: pre +} + +p.cmt { + color: gray +} + +span.warning { + color: red; + font-weight: bold +} + +/* !!!: How should we define this...? */ +span.file { + color: darkgreen +} + +table.remark { + background-color: #ffffc0; +} + +table.bar { + background-color: #a0c0ff; +} + +span.bartitle { + font-weight: bold; + font-style: italic; + color: darkblue +} diff --git a/docs/pkghelpfpGUI.pas b/docs/pkghelpfpGUI.pas new file mode 100644 index 00000000..dd80e222 --- /dev/null +++ b/docs/pkghelpfpGUI.pas @@ -0,0 +1,28 @@ +unit pkghelpfpGUI; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, HelpFPDoc; + +procedure Register; + +implementation + +procedure Register; +begin + // for Online help files +{ + RegisterFPDocHTMLHelpForPackage('fpGUI Help','fpGUI Help Database', + 'http://opensoft.homeip.net/fpgui/docs/','fpGUI'); +} + // for local help files + RegisterFPDocHTMLHelpForPackage('fpGUI Help','fpGUI Help Database', + 'file://$PkgDir(fpGUIHelpIntegration)/html','fpGUIHelpIntegration', '../src'); +// 'file://$PkgDir(fpGUI)/html','fpGUI','../src'); + +end; + +end. diff --git a/docs/update_docs.sh b/docs/update_docs.sh new file mode 100755 index 00000000..aa3a3d31 --- /dev/null +++ b/docs/update_docs.sh @@ -0,0 +1,4 @@ +#!/bin/sh +# fpc/bin must be in your PATH +makeskel --update --package=fpgui \ + --input='-Fi../src ../src/fpgui.pp' --descr="xml/fpgui.xml" --output="xml/fpgui.new.xml" diff --git a/docs/xml/examples/TComboBox.ex1.pas b/docs/xml/examples/TComboBox.ex1.pas new file mode 100644 index 00000000..8414a9d6 --- /dev/null +++ b/docs/xml/examples/TComboBox.ex1.pas @@ -0,0 +1,10 @@ +{ This example shows how we can setup a static TComboBox } + cbStyle := TComboBox.Create(self); + cbStyle.CanExpandWidth := True; + cbStyle.Items.Add('Windows'); // insert items into the combobox + cbStyle.Items.Add('WindowsXP'); + cbStyle.Items.Add('Motif'); + cbStyle.Items.Add('ClearLooks'); + cbStyle.Items.Add('OpenSoft'); + cbStyle.OnChange := @cbStyleChanged; // setup an event handler + cbStyle.ItemIndex := 0; // select the first item diff --git a/docs/xml/examples/TGroupBox.ex1.pas b/docs/xml/examples/TGroupBox.ex1.pas new file mode 100644 index 00000000..088352e8 --- /dev/null +++ b/docs/xml/examples/TGroupBox.ex1.pas @@ -0,0 +1,20 @@ +{ The following example shows how we can set up a TGroupBox with a layout } + grpOne := TGroupBox.Create('Group Box 1', self); + grpOne.CanExpandWidth := True; + + VBox1 := TBoxLayout.Create(self); + VBox1.Orientation := Vertical; + grpOne.InsertChild(VBox1); + + Radio1 := TRadioButton.Create('Radio button 1', self); + Radio2 := TRadioButton.Create('Radio button 2', self); + Radio3 := TRadioButton.Create('Radio button 3', self); + + Radio1.Checked := True; + Radio1.CanExpandWidth := True; + Radio2.CanExpandWidth := True; + Radio3.CanExpandWidth := True; + + VBox1.InsertChild(Radio1); + VBox1.InsertChild(Radio2); + VBox1.InsertChild(Radio3); diff --git a/docs/xml/fpgui.xml b/docs/xml/fpgui.xml new file mode 100644 index 00000000..bc6934e9 --- /dev/null +++ b/docs/xml/fpgui.xml @@ -0,0 +1,7731 @@ +<?xml version="1.0"?> +<fpdoc-descriptions> + <package name="fpgui"> + <!-- + ==================================================================== + fpGUI + ==================================================================== +--> + <module name="fpGUI"> + <short>fpGUI is a GUI (graphical user interface) library for Free Pascal</short> + <descr><printshort id="fpGUI"/>. It is fully object-oriented; its main goal is to provide its services independent of any operating system or graphics environment. All painting is done using fpGFX, while fpGUI provides a comfortable widget set and other high-level classes.</descr> + <!-- unresolved type reference Visibility: default --> + <element name="SysUtils"> + <short/> + <descr/> + <seealso/> + </element> + <!-- unresolved type reference Visibility: default --> + <element name="Classes"> + <short/> + <descr/> + <seealso/> + </element> + <!-- unresolved type reference Visibility: default --> + <element name="DOM"> + <short/> + <descr/> + <seealso/> + </element> + <!-- unresolved type reference Visibility: default --> + <element name="GFXBase"> + <short>Base unit from the fpGFX package.</short> + </element> + <!-- unresolved type reference Visibility: default --> + <element name="GFXImpl"> + <short>Abstract unit interfacing to the correct widget set. Part of fpGFX package.</short> + </element> + <!-- unresolved type reference Visibility: default --> + <element name="Contnrs"> + <short/> + <descr/> + <seealso/> + </element> + <!-- "type" alias type Visibility: default --> + <element name="TColor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="InfiniteSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clScrollBar"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clMenu"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clWindow"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clMenuText"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clWindowText"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clAppWorkSpace"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clHighlight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clHighlightText"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="cl3DFace"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="cl3DShadow"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clGrayText"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clBtnText"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="cl3DHighlight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="cl3DDkShadow"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="cl3DLight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clInfoText"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clInfoBk"> + <short/> + <descr/> + <seealso/> + </element> +<!-- constant Visibility: default --> +<element name="clBlack"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clMaroon"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clOlive"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clNavy"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clPurple"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clTeal"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clGray"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clSilver"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clLime"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clFuchsia"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clAqua"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clLtGray"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clDkGray"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clWhite"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clBtnFace"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clBtnShadow"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clBtnHighlight"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clAliceBlue"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clAntiqueWhite"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clAquamarine"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clAzure"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clBeige"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clBisque"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clBlanchedAlmond"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clBlueViolet"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clBrown"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clBurlyWood"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clCadetBlue"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clChartreuse"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clChocolate"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clLightYellow"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clCornsilk"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clMidnightBlue"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + +<!-- constant Visibility: default --> +<element name="clDarkWhite"> +<short></short> +<descr> +</descr> +<seealso> +</seealso> +</element> + <!-- resource string Visibility: default --> + <element name="mbText_Yes"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_No"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_Ok"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_Cancel"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_Apply"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_Abort"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_Retry"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_Ignore"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_All"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_NoToAll"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_YesToAll"> + <short/> + <descr/> + <seealso/> + </element> + <!-- resource string Visibility: default --> + <element name="mbText_Help"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomForm"/> + <!-- set type Visibility: default --> + <element name="TWidgetState"> + <short>The states a widget can be in.</short> + </element> + <!-- enumeration value Visibility: default --> + <element name="TWidgetState.wsEnabled"> + <short>Is the widget currently enabled or disabled?</short> + </element> + <!-- enumeration value Visibility: default --> + <element name="TWidgetState.wsIsVisible"> + <short>Widget and parents are visible</short> + </element> + <!-- enumeration value Visibility: default --> + <element name="TWidgetState.wsSizeIsForced"> + <short>If the current size has been forced - no auto resizes</short> + </element> + <!-- enumeration value Visibility: default --> + <element name="TWidgetState.wsHasFocus"> + <short>Widget has the input focus</short> + </element> + <!-- enumeration value Visibility: default --> + <element name="TWidgetState.wsMouseInside"> + <short>Mouse cursor is inside this widget</short> + </element> + <!-- enumeration value Visibility: default --> + <element name="TWidgetState.wsClicked"> + <short>User currently clicked on this widget</short> + </element> + <!-- enumeration type Visibility: default --> + <element name="TOrientation"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="TOrientation.Horizontal"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TOrientation.Vertical"><short/></element> + <!-- set type Visibility: default --> + <element name="TButtonFlags"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="TButtonFlags.btnIsEmbedded"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TButtonFlags.btnIsDefault"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TButtonFlags.btnIsPressed"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TButtonFlags.btnIsSelected"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TButtonFlags.btnHasFocus"><short/></element> + <!-- set type Visibility: default --> + <element name="TCheckboxFlags"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="TCheckboxFlags.cbIsPressed"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TCheckboxFlags.cbHasFocus"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TCheckboxFlags.cbIsEnabled"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TCheckboxFlags.cbIsChecked"><short/></element> + <!-- enumeration type Visibility: default --> + <element name="TMsgDlgBtn"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbYes"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbNo"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbOK"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbCancel"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbApply"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbAbort"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbRetry"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbIgnore"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbAll"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbNoToAll"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbYesToAll"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TMsgDlgBtn.mbHelp"><short/></element> + <!-- set type Visibility: default --> + <element name="TMsgDlgButtons"> + <short/> + <descr/> + <seealso/> + </element> + <!-- set type Visibility: default --> + <element name="TItemFlags"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="TItemFlags.ifFocused"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TItemFlags.ifSelected"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TItemFlags.ifDeactivated"><short/></element> + <!-- enumeration type Visibility: default --> + <element name="TArrowDirection"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="TArrowDirection.arrowUp"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TArrowDirection.arrowDown"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TArrowDirection.arrowLeft"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TArrowDirection.arrowRight"><short/></element> + <!-- object Visibility: default --> + <element name="TStyle"> + <short>The TStyle class is an abstract base class that encapsulates the look and feel of a GUI.</short> + <descr>fpGUI contains a set of TStyle subclasses that emulate the styles of the +different platforms supported by fpGUI (TWindowsStyle, TMotifStyle, etc.). By default, these styles are built into the fpGUI library. Styles are +preferably applied application wide, but can also be applied per widget. +fpGUI's built-in widgets use TStyle to perform all of their drawing, +ensuring that they look exactly like the equivalent native widgets.</descr> + <seealso><link id="TDefaultStyle"/></seealso> + </element> + <!-- variable Visibility: protected --> + <element name="TStyle.UIColorCache"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TStyle.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.Create.ADisplay"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.UpdateUIColorCache"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TStyle.GetGUIColor"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetGUIColor.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetGUIColor.Color"><short/></element> + <!-- function Visibility: public --> + <element name="TStyle.GetUIColor"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetUIColor.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetUIColor.AColor"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.SetUIColor"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.SetUIColor.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.SetUIColor.Color"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawText"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawText.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawText.APosition"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawText.AText"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawText.State"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawItemBefore"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawItemBefore.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawItemBefore.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawItemBefore.Flags"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawItemAfter"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawItemAfter.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawItemAfter.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawItemAfter.Flags"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawWindowBackground"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawWindowBackground.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawWindowBackground.ARect"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawButtonFace"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawButtonFace.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawButtonFace.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawButtonFace.Flags"><short/></element> + <!-- function Visibility: public --> + <element name="TStyle.GetButtonBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetButtonBorders.Result"><short/></element> + <!-- function Visibility: public --> + <element name="TStyle.GetSeparatorSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetSeparatorSize.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawSeparator"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawSeparator.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawSeparator.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawSeparator.AOrientation"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawGroupBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawGroupBox.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawGroupBox.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawGroupBox.ALabel"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawGroupBox.WidgetState"><short/></element> + <!-- function Visibility: public --> + <element name="TStyle.GetGroupBoxBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetGroupBoxBorders.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetGroupBoxBorders.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetGroupBoxBorders.ALabel"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetGroupBoxBorders.LabelWidth"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawEditBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawEditBox.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawEditBox.ARect"><short/></element> + <!-- function Visibility: public --> + <element name="TStyle.GetEditBoxBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetEditBoxBorders.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawCheckBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawCheckBox.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawCheckBox.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawCheckBox.LabelRect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawCheckBox.Flags"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.GetCheckBoxLayout"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.GetCheckBoxLayout.LabelSize"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetCheckBoxLayout.TotalSize"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetCheckBoxLayout.LabelPos"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawRadioButton"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawRadioButton.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawRadioButton.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawRadioButton.LabelRect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawRadioButton.Flags"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.GetRadioButtonLayout"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.GetRadioButtonLayout.LabelSize"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetRadioButtonLayout.TotalSize"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetRadioButtonLayout.LabelPos"><short/></element> + <!-- function Visibility: public --> + <element name="TStyle.GetComboBoxArrowSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetComboBoxArrowSize.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawComboBoxArrow"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawComboBoxArrow.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawComboBoxArrow.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawComboBoxArrow.IsPressed"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawComboBoxArrow.IsEnabled"><short/></element> + <!-- function Visibility: public --> + <element name="TStyle.GetScrollBarBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetScrollBarBorders.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetScrollBarBorders.Orientation"><short/></element> + <!-- function Visibility: public --> + <element name="TStyle.GetScrollBarBtnSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetScrollBarBtnSize.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetScrollBarBtnSize.Orientation"><short/></element> + <!-- function Visibility: public --> + <element name="TStyle.GetScrollBarBtnMinSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetScrollBarBtnMinSize.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawScrollBarBorder"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawScrollBarBorder.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawScrollBarBorder.ARect"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawScrollBarButton"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawScrollBarButton.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawScrollBarButton.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawScrollBarButton.Direction"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawScrollBarButton.IsPressed"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawScrollBarButton.IsEnabled"><short/></element> + <!-- function Visibility: public --> + <element name="TStyle.GetScrollBoxBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetScrollBoxBorders.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawScrollBoxBorder"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawScrollBoxBorder.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawScrollBoxBorder.ARect"><short/></element> + <!-- object Visibility: default --> + <element name="TDefaultStyle"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TDefaultStyle.ImageCanvas"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TDefaultStyle.MaskCanvas"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TDefaultStyle.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.Create.ADisplay"><short/></element> + <!-- destructor Visibility: public --> + <element name="TDefaultStyle.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.Draw3DFrame"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.Draw3DFrame.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.Draw3DFrame.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.Draw3DFrame.Color1"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.Draw3DFrame.Color2"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.Draw3DFrame.Color3"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.Draw3DFrame.Color4"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawFocusRect"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawFocusRect.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawFocusRect.ARect"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawSunkenOuterBorder"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawSunkenOuterBorder.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawSunkenOuterBorder.ARect"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetGUIColor"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetGUIColor.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetGUIColor.Color"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawText"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawText.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawText.APosition"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawText.AText"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawText.State"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawItemBefore"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawItemBefore.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawItemBefore.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawItemBefore.Flags"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawItemAfter"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawItemAfter.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawItemAfter.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawItemAfter.Flags"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawWindowBackground"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawWindowBackground.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawWindowBackground.ARect"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawButtonFace"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawButtonFace.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawButtonFace.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawButtonFace.Flags"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetButtonBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetButtonBorders.Result"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetSeparatorSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetSeparatorSize.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawSeparator"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawSeparator.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawSeparator.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawSeparator.AOrientation"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawGroupBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawGroupBox.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawGroupBox.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawGroupBox.ALabel"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawGroupBox.WidgetState"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetGroupBoxBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetGroupBoxBorders.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetGroupBoxBorders.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetGroupBoxBorders.ALabel"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetGroupBoxBorders.LabelWidth"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawEditBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawEditBox.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawEditBox.ARect"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetEditBoxBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetEditBoxBorders.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawCheckBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawCheckBox.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawCheckBox.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawCheckBox.LabelRect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawCheckBox.Flags"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.GetCheckBoxLayout"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetCheckBoxLayout.LabelSize"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetCheckBoxLayout.TotalSize"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetCheckBoxLayout.LabelPos"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawRadioButton"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawRadioButton.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawRadioButton.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawRadioButton.LabelRect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawRadioButton.Flags"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.GetRadioButtonLayout"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetRadioButtonLayout.LabelSize"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetRadioButtonLayout.TotalSize"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetRadioButtonLayout.LabelPos"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetComboBoxArrowSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetComboBoxArrowSize.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawComboBoxArrow"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawComboBoxArrow.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawComboBoxArrow.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawComboBoxArrow.IsPressed"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawComboBoxArrow.IsEnabled"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetScrollBarBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetScrollBarBorders.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetScrollBarBorders.Orientation"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetScrollBarBtnSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetScrollBarBtnSize.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetScrollBarBtnSize.Orientation"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetScrollBarBtnMinSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetScrollBarBtnMinSize.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawScrollBarBorder"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawScrollBarBorder.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawScrollBarBorder.ARect"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawScrollBarButton"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawScrollBarButton.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawScrollBarButton.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawScrollBarButton.Direction"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawScrollBarButton.IsPressed"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawScrollBarButton.IsEnabled"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetScrollBoxBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetScrollBoxBorders.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDefaultStyle.DrawScrollBoxBorder"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawScrollBoxBorder.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.DrawScrollBoxBorder.ARect"><short/></element> + <!-- object Visibility: default --> + <element name="TEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TEventObj.RefCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TEventObj.FSender"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TEventObj.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TEventObj.Create.ASender"><short/></element> + <!-- procedure Visibility: public --> + <element name="TEventObj.AddRef"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TEventObj.Release"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TEventObj.SendToChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TEventObj.SendToChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TEventObj.SendToChild.AChild"><short/></element> + <!-- property Visibility: published --> + <element name="TEventObj.Sender"> + <short/> + <descr/> + <seealso/> + </element> + <!-- "class of" type Visibility: default --> + <element name="TEventClass"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TLayoutingEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCalcSizesEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TResizedEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TResizedEventObj.FIsForced"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TResizedEventObj.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TResizedEventObj.Create.ASender"><short/></element> + <!-- argument Visibility: default --> + <element name="TResizedEventObj.Create.AIsForced"><short/></element> + <!-- property Visibility: published --> + <element name="TResizedEventObj.IsForced"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TDestroyEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TEnabledChangeEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TVisibilityChangeEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TPaintingEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TPaintingEventObj.FCanvas"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TPaintingEventObj.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TPaintingEventObj.Create.ASender"><short/></element> + <!-- argument Visibility: default --> + <element name="TPaintingEventObj.Create.ACanvas"><short/></element> + <!-- property Visibility: published --> + <element name="TPaintingEventObj.Canvas"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TPreparePaintEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TPreparePaintEventObj.SendToChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TPreparePaintEventObj.SendToChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TPreparePaintEventObj.SendToChild.AChild"><short/></element> + <!-- object Visibility: default --> + <element name="TPaintEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TPaintEventObj.SendToChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TPaintEventObj.SendToChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TPaintEventObj.SendToChild.AChild"><short/></element> + <!-- object Visibility: default --> + <element name="TMouseEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMouseEventObj.FShift"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMouseEventObj.FPosition"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TMouseEventObj.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMouseEventObj.Create.ASender"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseEventObj.Create.AShift"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseEventObj.Create.APosition"><short/></element> + <!-- function Visibility: public --> + <element name="TMouseEventObj.SendToChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMouseEventObj.SendToChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseEventObj.SendToChild.AChild"><short/></element> + <!-- property Visibility: public --> + <element name="TMouseEventObj.Position"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TMouseEventObj.Shift"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TMouseButtonEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMouseButtonEventObj.FButton"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TMouseButtonEventObj.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMouseButtonEventObj.Create.ASender"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseButtonEventObj.Create.AButton"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseButtonEventObj.Create.AShift"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseButtonEventObj.Create.APosition"><short/></element> + <!-- property Visibility: published --> + <element name="TMouseButtonEventObj.Button"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TMousePressedEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TMouseReleasedEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TMouseMoveEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TMouseMoveEventObj.SendToChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMouseMoveEventObj.SendToChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseMoveEventObj.SendToChild.AChild"><short/></element> + <!-- object Visibility: default --> + <element name="TMouseEnterEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: public --> + <element name="TMouseEnterEventObj.NewCursor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TMouseLeaveEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TMouseLeaveEventObj.SendToChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMouseLeaveEventObj.SendToChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseLeaveEventObj.SendToChild.AChild"><short/></element> + <!-- object Visibility: default --> + <element name="TMouseLeaveCheckEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TMouseLeaveCheckEventObj.SendToChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMouseLeaveCheckEventObj.SendToChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseLeaveCheckEventObj.SendToChild.AChild"><short/></element> + <!-- variable Visibility: public --> + <element name="TMouseLeaveCheckEventObj.NewCursor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TMouseWheelEventObj"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMouseWheelEventObj.FWheelDelta"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TMouseWheelEventObj.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMouseWheelEventObj.Create.ASender"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseWheelEventObj.Create.AShift"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseWheelEventObj.Create.AWheelDelta"><short/></element> + <!-- argument Visibility: default --> + <element name="TMouseWheelEventObj.Create.APosition"><short/></element> + <!-- property Visibility: published --> + <element name="TMouseWheelEventObj.WheelDelta"> + <short/> + <descr/> + <seealso/> + </element> + <!-- set type Visibility: default --> + <element name="TWidgetStyle"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="TWidgetStyle.wsCaptureMouse"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TWidgetStyle.wsClickable"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TWidgetStyle.wsOpaque"><short/></element> + <!-- object Visibility: default --> + <element name="TWidget"> + <short>The TWidget class is the base class of all user interface objects.</short> + <descr> + <p>Widgets are components that are normally visual and the user can see +them and possibly interact with them at runtime. All widgets have properties, +methods and events that describe aspects of their appearance, such as the +position of the widget, the cursor or hint associated with the widget, +methods to paint or move the widget and events that respond to user +actions. +</p> + <p>TWidget has many protected properties and methods that are used or +published by its descendants. +</p> + <p>If you want to use a TWidget to hold child widgets you will probably +want to add a layout to the parent TWidget.</p> + </descr> + <seealso><link id="TLayout"/></seealso> + </element> + <!-- variable Visibility: private --> + <element name="TWidget.FParent"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TWidget.FOnClick"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TWidget.SetParent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.SetParent.AParent"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.GetBoundsRect"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.GetBoundsRect.Result"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.GetLeft"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.GetLeft.Result"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.GetTop"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.GetTop.Result"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.GetWidth"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.GetWidth.Result"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.GetHeight"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.GetHeight.Result"><short/></element> + <!-- procedure Visibility: private --> + <element name="TWidget.SetEnabled"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.SetEnabled.AEnabled"><short/></element> + <!-- procedure Visibility: private --> + <element name="TWidget.SetVisible"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.SetVisible.AVisible"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.EvCalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.EvCalcSizes.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.EvCalcSizes.Event"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.EvEnabledChange"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.EvEnabledChange.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.EvEnabledChange.Event"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.EvVisibilityChange"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.EvVisibilityChange.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.EvVisibilityChange.Event"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.EvMousePressed"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.EvMousePressed.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.EvMousePressed.Event"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.EvMouseReleased"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.EvMouseReleased.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.EvMouseReleased.Event"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.EvMouseEnter"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.EvMouseEnter.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.EvMouseEnter.Event"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.EvMouseLeave"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.EvMouseLeave.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.EvMouseLeave.Event"><short/></element> + <!-- function Visibility: private --> + <element name="TWidget.EvMouseLeaveCheck"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.EvMouseLeaveCheck.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.EvMouseLeaveCheck.Event"><short/></element> + <!-- variable Visibility: protected --> + <element name="TWidget.FCursor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FText"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FStyle"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FCanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FCanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FEnabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FVisible"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FOrigin"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FBoundsSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FClientRect"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FMinSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FMaxSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.FDefSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.WidgetStyle"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TWidget.WidgetState"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TWidget.Loaded"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TWidget.Click"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TWidget.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TWidget.SetParentComponent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.SetParentComponent.AParent"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TWidget.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TWidget.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: protected --> + <element name="TWidget.ProcessEvent"> + <short>Processes all incoming event objects</short> + <descr> + <p><printshort id="TWidget.ProcessEvent"/>. Inside this event you normally verify the type of event object and pass it to a private event handler method, to do further processing.</p> + <p>This method gets called before the <var>DistributeEvent</var> method.</p> + </descr> + <seealso><link id="TWidget.DistributeEvent"/></seealso> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.ProcessEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.ProcessEvent.Event"><short/></element> + <!-- function Visibility: protected --> + <element name="TWidget.DistributeEvent"> + <short>Distributes event objects to it's children</short> + <descr><printshort id="TWidget.DistributeEvent"/>. This event occurs after the <var>ProcessEvent</var>.</descr> + <seealso><link id="TWidget.ProcessEvent"/></seealso> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.DistributeEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.DistributeEvent.Event"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TWidget.EvFocusChanged"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TWidget.EvKeyPressed"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.EvKeyPressed.Key"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.EvKeyPressed.Shift"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TWidget.EvKeyReleased"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.EvKeyReleased.Key"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.EvKeyReleased.Shift"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TWidget.EvKeyChar"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.EvKeyChar.KeyChar"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TWidget.EvTextChanged"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: protected --> + <element name="TWidget.DoMouseEnter"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.DoMouseEnter.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.DoMouseEnter.AShift"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.DoMouseEnter.AMousePos"><short/></element> + <!-- function Visibility: protected --> + <element name="TWidget.GetStyle"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.GetStyle.Result"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TWidget.SetCanExpandWidth"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.SetCanExpandWidth.allow"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TWidget.SetCanExpandHeight"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.SetCanExpandHeight.allow"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TWidget.SetText"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.SetText.AText"><short/></element> + <!-- property Visibility: protected --> + <element name="TWidget.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TWidget.CanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TWidget.Cursor"> + <short>Specifies the image used to represent the mouse pointer when it passes into the region covered by the widget.</short> + <descr>Change the value of Cursor to provide feedback to the user when the mouse pointer enters the widget. The value of Cursor is the enumerated type of the cursor in the set of cursors maintained by fpGFX (fpGFXBase unit).</descr> + </element> + <!-- property Visibility: protected --> + <element name="TWidget.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TWidget.OnClick"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TWidget.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.Create.AOwner"><short/></element> + <!-- destructor Visibility: public --> + <element name="TWidget.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TWidget.SendEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.SendEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.SendEvent.Event"><short/></element> + <!-- function Visibility: public --> + <element name="TWidget.FindForm"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.FindForm.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TWidget.SetEmbeddedParent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.SetEmbeddedParent.AParent"><short/></element> + <!-- procedure Visibility: public --> + <element name="TWidget.SetBounds"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.SetBounds.APosition"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.SetBounds.ASize"><short/></element> +<!-- argument Visibility: default --> +<element name="TWidget.SetBounds.x"> +<short></short> +</element> + +<!-- argument Visibility: default --> +<element name="TWidget.SetBounds.y"> +<short></short> +</element> + +<!-- argument Visibility: default --> +<element name="TWidget.SetBounds.w"> +<short></short> +</element> + +<!-- argument Visibility: default --> +<element name="TWidget.SetBounds.h"> +<short></short> +</element> + <!-- function Visibility: public --> + <element name="TWidget.WidgetToClient"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.WidgetToClient.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.WidgetToClient.APoint"><short/></element> + <!-- function Visibility: public --> + <element name="TWidget.ClientToWidget"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.ClientToWidget.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.ClientToWidget.APoint"><short/></element> + <!-- function Visibility: public --> + <element name="TWidget.ClientToScreen"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TWidget.ClientToScreen.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.ClientToScreen.APoint"><short/></element> + <!-- procedure Visibility: public --> + <element name="TWidget.Show"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TWidget.Hide"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TWidget.Redraw"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TWidget.Redraw"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.Redraw.ARect"><short/></element> + <!-- procedure Visibility: public --> + <element name="TWidget.Scroll"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.Scroll.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.Scroll.DeltaX"><short/></element> + <!-- argument Visibility: default --> + <element name="TWidget.Scroll.DeltaY"><short/></element> + <!-- procedure Visibility: public --> + <element name="TWidget.SetFocus"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TWidget.Update"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.Parent"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.Origin"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.BoundsSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.BoundsRect"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.Left"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.Top"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.Width"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.Height"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.MinSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.MaxSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.DefSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.ClientRect"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TWidget.Style"> + <short>Sets or Gets the widget's GUI style</short> + <descr> + <p>Sets or Gets the widget's GUI style. The ownership of the style object is not transferred. +</p> + <p>If no style is set, the widget uses the application's style, TApplication.DefaultStyle instead. +</p> + <p><b>Warning:</b> +This function is particularly useful for demonstration purposes, where you want to show +fpGUI's styling capabilities. Real applications should avoid it and use one consistent GUI style instead. +</p> + </descr> + <seealso> + <link id="TApplication.DefaultStyle"/> + <link id="TStyle"/> + </seealso> + </element> + <!-- property Visibility: public --> + <element name="TWidget.Enabled"> + <short>Controls whether the widget responds to mouse, keyboard and timer events.</short> + <descr>Use Enabled to change the availability of the widget to the user. To +disable a control, set Enabled to false. Disabled controls appear dimmed. +If Enabled is false, the control ignores mouse, keyboard and timer events.</descr> + </element> + <!-- property Visibility: public --> + <element name="TWidget.Visible"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TContainerWidget"> + <short>TContainerWidget is an abstract class that defines the interface for containing other widgets</short> + <descr><printshort id="TContainerWidget"/> +. It also implements the distribution of events to child widgets. You can't create an instance of this class, as it contains abstract methods, and doesn't actually define internally how to store references to child widgets. It purely defines the interface in doing so. This class is a decendant of +<link id="TWidget">TWidget </link> + and must be used as a base for container widgets. <link id="TLayout">TLayout </link> + is an example of a container class that can hold multiple children. <link id="TBinWidget">TBinWidget </link> + is an example of a container class that can hold only a single child widget - normally a TLayout descendant.</descr> + <seealso> + <link id="TWidget"/> + <link id="TBinWidget"/> + <link id="TLayout"/> + </seealso> + </element> + <!-- function Visibility: protected --> + <element name="TContainerWidget.DistributeEvent"> + <short>Distributes <link id="TEventObj">Event objects </link> to all children widgets</short> + <descr><printshort id="TContainerWidget.DistributeEvent"/>.</descr> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TContainerWidget.DistributeEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TContainerWidget.DistributeEvent.Event"><short/></element> + <!-- function Visibility: protected --> + <element name="TContainerWidget.GetChildCount"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TContainerWidget.GetChildCount.Result"><short/></element> + <!-- function Visibility: protected --> + <element name="TContainerWidget.GetChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TContainerWidget.GetChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TContainerWidget.GetChild.Index"><short/></element> + <!-- property Visibility: protected --> + <element name="TContainerWidget.ChildCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TContainerWidget.Children"> + <short/> + <descr/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TContainerWidget.Children.Index"><short/></element> + <!-- function Visibility: public --> + <element name="TContainerWidget.GetChildAt"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TContainerWidget.GetChildAt.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TContainerWidget.GetChildAt.APoint"><short/></element> + <!-- function Visibility: public --> + <element name="TContainerWidget.ContainsChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TContainerWidget.ContainsChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TContainerWidget.ContainsChild.AChild"><short/></element> + <!-- procedure Visibility: public --> + <element name="TContainerWidget.InsertChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TContainerWidget.InsertChild.AChild"><short/></element> + <!-- procedure Visibility: public --> + <element name="TContainerWidget.RemoveChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TContainerWidget.RemoveChild.AChild"><short/></element> + <!-- object Visibility: default --> + <element name="TBinWidget"> + <short>This is a concrete class that implements all the TContainerWidget's abstract methods</short> + <descr><printshort id="TBinWidget"/> +. This class adds the ability to contain a single child widget - normally a TLayout descendant. Examples of such classes are the +<link id="TForm">TForm </link> + and <link id="TGroupBox">TGroupBox</link> +. + For examples of container classes that can hold multiple children, look at <link id="TLayout">TLayout </link> + and it's descendants.</descr> + <seealso> + <link id="TContainerWidget"/> + <link id="TLayout"/> + <link id="TGroupBox"/> + <link id="TForm"/> + </seealso> + </element> + <!-- variable Visibility: protected --> + <element name="TBinWidget.FChild"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TBinWidget.SetChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TBinWidget.SetChild.AChild"><short/></element> + <!-- function Visibility: protected --> + <element name="TBinWidget.GetChildCount"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TBinWidget.GetChildCount.Result"><short/></element> + <!-- function Visibility: protected --> + <element name="TBinWidget.GetChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TBinWidget.GetChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TBinWidget.GetChild.Index"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TBinWidget.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TBinWidget.Child"> + <short/> + <descr/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TBinWidget.ContainsChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TBinWidget.ContainsChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TBinWidget.ContainsChild.AChild"><short/></element> + <!-- procedure Visibility: public --> + <element name="TBinWidget.InsertChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TBinWidget.InsertChild.AChild"><short/></element> + <!-- procedure Visibility: public --> + <element name="TBinWidget.RemoveChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TBinWidget.RemoveChild.AChild"><short/></element> + <!-- object Visibility: default --> + <element name="ELayoutError"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- enumeration type Visibility: default --> + <element name="THorzAlign"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="THorzAlign.horzLeft"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="THorzAlign.horzCenter"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="THorzAlign.horzRight"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="THorzAlign.horzFill"><short/></element> + <!-- enumeration type Visibility: default --> + <element name="TVertAlign"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="TVertAlign.vertTop"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TVertAlign.vertCenter"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TVertAlign.vertBottom"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TVertAlign.vertFill"><short/></element> + <!-- object Visibility: default --> + <element name="TLayoutItem"> + <short>A data class used internall for TBoxLayout</short> + <descr><printshort id="TLayoutItem"/>. It also serves as the base class for other layout items.</descr> + <seealso> + <link id="TGridItem"/> + <link id="TFixedItem"/> + </seealso> + </element> + <!-- variable Visibility: private --> + <element name="TLayoutItem.FWidget"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TLayoutItem.Widget"> + <short/> + <descr/> + <seealso/> + </element> + <!-- record type Visibility: default --> + <element name="TWidgetArrayInfo"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: default --> + <element name="TWidgetArrayInfo.min"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: default --> + <element name="TWidgetArrayInfo.def"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: default --> + <element name="TWidgetArrayInfo.max"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: default --> + <element name="TWidgetArrayInfo.MinFlag"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: default --> + <element name="TWidgetArrayInfo.MaxFlag"> + <short/> + <descr/> + <seealso/> + </element> + <!-- array type Visibility: default --> + <element name="TWidgetArrayInfoArray"> + <short/> + <descr/> + <seealso/> + </element> + <!-- pointer type Visibility: default --> + <element name="PWidgetArrayInfoArray"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TLayout"> + <short>The fpGUI layout system provides a simple and powerful way of specifying the layout of child widgets</short> + <descr> + <p><printshort id="TLayout"/>.</p> + <p>By specifying the logical layout once, you get the following benefits:</p> + <ul> + <li>Positioning of child widgets.</li> + <li>Sensible default sizes for windows.</li> + <li>Sensible minimum sizes for windows.</li> + <li>Resize handling.</li> + <li> + <p>Automatic update when contents change:</p> + <ul> + <li>Font size, text or other contents of child widgets.</li> + <li>Hiding or showing a child widget.</li> + <li>Removal of child widgets.</li> + </ul> + </li> + </ul> + </descr> + <seealso> + <link id="TBoxLayout"/> + <link id="TGridLayout"/> + <link id="TDockingLayout"/> + <link id="TFixedLayout"/> + </seealso> + </element> + <!-- variable Visibility: protected --> + <element name="TLayout.FWidgets"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TLayout.FBorderSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TLayout.IsRecalcingLayout"> + <short/> + <descr/> + <seealso/> + </element> + <!-- function Visibility: protected --> + <element name="TLayout.GetChildCount"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TLayout.GetChildCount.Result"><short/></element> + <!-- function Visibility: protected --> + <element name="TLayout.GetChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TLayout.GetChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TLayout.GetChild.Index"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TLayout.AddFixedChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TLayout.AddFixedChild.AChild"><short/></element> + <!-- property Visibility: protected --> + <element name="TLayout.BorderSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TLayout.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TLayout.Create.AOwner"><short/></element> + <!-- destructor Visibility: public --> + <element name="TLayout.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TLayout.ContainsChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TLayout.ContainsChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TLayout.ContainsChild.AChild"><short/></element> + <!-- object Visibility: default --> + <element name="TFixedItem"> + <short>A data class used internally for TFixedLayout</short> + <descr><printshort id="TFixedItem"/>.</descr> + </element> + <!-- variable Visibility: public --> + <element name="TFixedItem.Left"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: public --> + <element name="TFixedItem.Top"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TFixedLayout"> + <short>The TFixedLayout allows you to arrange widgets at set x and y co-ordinates</short> + <descr><printshort id="TFixedLayout"/>. This is like the current Form Designers of Lazarus and Borland Delphi works.</descr> + <seealso> + <link id="TGridLayout"/> + <link id="TBoxLayout"/> + </seealso> + </element> + <!-- procedure Visibility: protected --> + <element name="TFixedLayout.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TFixedLayout.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TFixedLayout.Create.AOwner"><short/></element> + <!-- procedure Visibility: public --> + <element name="TFixedLayout.AddWidget"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TFixedLayout.AddWidget.AWidget"><short/></element> + <!-- argument Visibility: default --> + <element name="TFixedLayout.AddWidget.ALeft"><short/></element> + <!-- argument Visibility: default --> + <element name="TFixedLayout.AddWidget.ATop"><short/></element> + <!-- procedure Visibility: public --> + <element name="TFixedLayout.MoveWidget"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TFixedLayout.MoveWidget.AWidget"><short/></element> + <!-- argument Visibility: default --> + <element name="TFixedLayout.MoveWidget.ALeft"><short/></element> + <!-- argument Visibility: default --> + <element name="TFixedLayout.MoveWidget.ATop"><short/></element> + <!-- property Visibility: published --> + <element name="TFixedLayout.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration type Visibility: default --> + <element name="TDockingMode"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="TDockingMode.dmTop"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TDockingMode.dmBottom"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TDockingMode.dmLeft"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TDockingMode.dmRight"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TDockingMode.dmClient"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TDockingMode.dmUndocked"><short/></element> + <!-- object Visibility: default --> + <element name="TDockingItem"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: public --> + <element name="TDockingItem.Left"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: public --> + <element name="TDockingItem.Top"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: public --> + <element name="TDockingItem.DockingMode"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TDockingLayout"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TDockingLayout.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TDockingLayout.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDockingLayout.Create.AOwner"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDockingLayout.AddWidget"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDockingLayout.AddWidget.AWidget"><short/></element> + <!-- argument Visibility: default --> + <element name="TDockingLayout.AddWidget.ADockingMode"><short/></element> + <!-- procedure Visibility: public --> + <element name="TDockingLayout.AddWidget"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDockingLayout.AddWidget.AWidget"><short/></element> + <!-- argument Visibility: default --> + <element name="TDockingLayout.AddWidget.ALeft"><short/></element> + <!-- argument Visibility: default --> + <element name="TDockingLayout.AddWidget.ATop"><short/></element> + <!-- property Visibility: published --> + <element name="TDockingLayout.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomBoxLayout"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomBoxLayout.FHorzAlign"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomBoxLayout.FVertAlign"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomBoxLayout.FOrientation"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomBoxLayout.FSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomBoxLayout.SetOrientation"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomBoxLayout.SetOrientation.AOrientation"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomBoxLayout.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomBoxLayout.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomBoxLayout.HorzAlign"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomBoxLayout.VertAlign"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomBoxLayout.Orientation"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomBoxLayout.Spacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomBoxLayout.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomBoxLayout.Create.AOwner"><short/></element> + <!-- procedure Visibility: public --> + <element name="TCustomBoxLayout.InsertChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomBoxLayout.InsertChild.AChild"><short/></element> + <!-- procedure Visibility: public --> + <element name="TCustomBoxLayout.RemoveChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomBoxLayout.RemoveChild.AChild"><short/></element> + <!-- object Visibility: default --> + <element name="TBoxLayout"> + <short>Lays out widgets in a horizontal or vertical position.</short> + <descr>A TBoxLayout lays out widgets in a horizontal row, from left to right, or in a vertical column, from top to bottom. By default, the TBoxLayout uses the horizontal layout. You can toggle between horizontal and vertical layouts, by using the Orientation property.</descr> + <seealso> + <link id="TBoxLayout"/> + <link id="TGridLayout"/> + <link id="TDockingLayout"/> + <link id="TFixedLayout"/> + </seealso> + </element> + <!-- property Visibility: published --> + <element name="TBoxLayout.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TBoxLayout.CanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TBoxLayout.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TBoxLayout.BorderSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TBoxLayout.HorzAlign"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TBoxLayout.Orientation"> + <short>Toggle the layout of the TBoxLayout class.</short> + <descr>Two possible orientations exist - Horizontal (the default) or Vertical.</descr> + </element> + <!-- property Visibility: published --> + <element name="TBoxLayout.Spacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TBoxLayout.VertAlign"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TGridItem"> + <short>A data class used internally for TGridLayout</short> + <descr><printshort id="TGridItem"/>.</descr> + </element> + <!-- variable Visibility: private --> + <element name="TGridItem.FX"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TGridItem.FY"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TGridItem.FWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TGridItem.FHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TGridItem.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TGridItem.Create.ACollection"><short/></element> + <!-- property Visibility: published --> + <element name="TGridItem.x"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TGridItem.y"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TGridItem.Width"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TGridItem.Height"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomGridLayout"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGridLayout.FColCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGridLayout.FRowCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGridLayout.FColSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGridLayout.FRowSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomGridLayout.SetColCount"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.SetColCount.AColCount"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGridLayout.SetRowCount"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.SetRowCount.ARowCount"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGridLayout.SetColSpacing"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.SetColSpacing.AColSpacing"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGridLayout.SetRowSpacing"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.SetRowSpacing.ARowSpacing"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomGridLayout.InitSizeInfos"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.InitSizeInfos.ColInfos"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.InitSizeInfos.RowInfos"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomGridLayout.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomGridLayout.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGridLayout.GridPositions"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGridLayout.ColCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGridLayout.RowCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGridLayout.ColSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGridLayout.RowSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomGridLayout.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.Create.AOwner"><short/></element> + <!-- procedure Visibility: public --> + <element name="TCustomGridLayout.InsertChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.InsertChild.AChild"><short/></element> + <!-- procedure Visibility: public --> + <element name="TCustomGridLayout.AddWidget"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.AddWidget.AWidget"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.AddWidget.x"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.AddWidget.y"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.AddWidget.w"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.AddWidget.h"><short/></element> + <!-- procedure Visibility: public --> + <element name="TCustomGridLayout.MoveWidget"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.MoveWidget.AWidget"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.MoveWidget.x"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.MoveWidget.y"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.MoveWidget.w"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.MoveWidget.h"><short/></element> + <!-- object Visibility: default --> + <element name="TGridLayout"> + <short>The TGridLayout class lays out widgets in a grid.</short> + <descr> + <p>TGridLayout takes the space made available to it (by its parent layout +or by the Parent), divides it up into rows and columns, and puts each +widget it manages into the correct cell. +</p> + <p>Columns and rows behave identically. A TGridLayout lays out widgets +in a two-dimensional grid. Widgets can also occupy multiple cells. +</p> + <table border="1" width="300"> + <tr> + <td>0,0</td> + <td>0,1</td> + <td>0,2</td> + </tr> + <tr> + <td>1,0</td> + <td>1,1</td> + <td>1,2</td> + </tr> + <tr> + <td>2,0</td> + <td>2,1</td> + <td>2,2</td> + </tr> + </table> + </descr> + </element> + <!-- property Visibility: published --> + <element name="TGridLayout.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TGridLayout.ColCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TGridLayout.RowCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TGridLayout.ColSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TGridLayout.RowSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TGridLayout.GridPositions"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomLabel"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomLabel.SetAlignment"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomLabel.SetAlignment.AAlignment"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomLabel.FAlignment"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomLabel.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomLabel.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomLabel.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomLabel.Alignment"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TLabel"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TLabel.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TLabel.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TLabel.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TLabel.Alignment"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomEdit"> + <short>Base Edit component with no published properties.</short> + <seealso><link id="TEdit"/></seealso> + </element> + <!-- variable Visibility: private --> + <element name="TCustomEdit.FOnChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomEdit.SetPasswordChar"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.SetPasswordChar.APasswordChar"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomEdit.SetCursorPos"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.SetCursorPos.ACursorPos"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomEdit.FPasswordChar"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomEdit.FCursorPos"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomEdit.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomEdit.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomEdit.EvKeyPressed"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.EvKeyPressed.Key"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.EvKeyPressed.Shift"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomEdit.EvKeyChar"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.EvKeyChar.KeyChar"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomEdit.EvTextChanged"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomEdit.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomEdit.Cursor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomEdit.PasswordChar"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomEdit.CursorPos"> + <short>Position of cursor in the edit widget</short> + <descr><printshort id="TCustomEdit.CursorPos"/>. If CursorPos = 0 then the +cursor in infront of the first character of text. If CursorPos = 1 then +the cursor is after the first character of text, etc.</descr> + </element> + <!-- property Visibility: protected --> + <element name="TCustomEdit.OnChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomEdit.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.Create.AOwner"><short/></element> + <!-- object Visibility: default --> + <element name="TEdit"> + <short>The TEdit widget is a one-line text editor</short> + <descr> + <p><printshort id="TEdit"/>. A TEdit allows the user to enter and edit a single line of plain +text.</p> + <p>By changing the <link id="TEdit.PasswordChar">PasswordChar</link> property of a + TEdit, it can also be used as a "write-only" field, for inputs such as passwords.</p> + </descr> + <seealso><link id="TEdit.PassworChar"/></seealso> + </element> + <!-- property Visibility: published --> + <element name="TEdit.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TEdit.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TEdit.PasswordChar"> + <short>Character to use when masking the text input</short> + <descr><printshort id="TEdit.PasswordChar"/>. The default is ascii char 0, which will then display the +TEdit text as normal. Changing it to any other character, will show the TEdit text masked +with this character. The most used PasswordChar is the '*' character for password fields.</descr> + </element> + <!-- property Visibility: published --> + <element name="TEdit.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TEdit.OnChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TGenericButton"> + <short>Defines a button that could be embedded in another component.</short> + <descr>This class defines a button that could be embedded in another component. + No default minimum size gets applied either. This is the most basic button you + can use. Example of usage: The TScrollbar and TComboBox components use TGenericButtons.</descr> + <errors/> + <seealso> + <link id="TCustomButton"/> + <link id="TButton"/> + </seealso> + </element> + <!-- variable Visibility: protected --> + <element name="TGenericButton.FEmbedded"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TGenericButton.Paint"> + <short>Draw the blank button face on the canvas.</short> + <descr>This method draws a blank button face on the canvas. Nothing else gets + drawn. This method also takes into account if the button is Embedded on not, + which will affect the buttons look in some ways. eg: Must it have a Focus Rectangle + or not.</descr> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TGenericButton.Paint.Canvas"><short/></element> + <!-- constructor Visibility: public --> + <element name="TGenericButton.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TGenericButton.Create.AOwner"><short/></element> + <!-- property Visibility: public --> + <element name="TGenericButton.Embedded"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomButton"> + <short>Used to create new custom type of button components</short> + <descr>Used to create new custom type of buttons normally used in dialogs and windows. +There are also no properties published in this component and in has a default +minimum width set to 75 pixels.</descr> + <seealso> + <link id="TGenericButton"/> + <link id="TButton"/> + </seealso> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomButton.Paint"> + <short>This draws the Text on the already draw button face.</short> + <descr>This draws the Text on the already draw button face.</descr> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomButton.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomButton.CalcSizes"> + <short>Calculates the size of the button.</short> + <descr>This method calculates the size of the button and also applies the default + minimum size of 75 pixels wide.</descr> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TButton"> + <seealso><link id="TCustomButton"/></seealso> + </element> + <!-- property Visibility: published --> + <element name="TButton.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TButton.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TButton.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TButton.OnClick"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure type Visibility: default --> + <element name="TScrollEvent"> + <short/> + <descr/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TScrollEvent.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TScrollEvent.APosition"><short/></element> + <!-- object Visibility: default --> + <element name="TCustomScrollBar"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.FOrientation"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.FMin"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.FMax"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.FPageSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.FPosition"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.FSmallChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.FLargeChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.FOnChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.FOnScroll"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.ButtonUp"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.ButtonDown"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.Slider"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomScrollBar.Embedded"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomScrollBar.ButtonUpClick"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.ButtonUpClick.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomScrollBar.ButtonDownClick"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.ButtonDownClick.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomScrollBar.SetOrientation"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.SetOrientation.AOrientation"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomScrollBar.SetMin"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.SetMin.AMin"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomScrollBar.SetMax"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.SetMax.AMax"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomScrollBar.SetPageSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.SetPageSize.APageSize"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomScrollBar.SetPosition"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.SetPosition.APosition"><short/></element> + <!-- function Visibility: private --> + <element name="TCustomScrollBar.GetButtonSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomScrollBar.GetButtonSize.Result"><short/></element> + <!-- function Visibility: private --> + <element name="TCustomScrollBar.ClipPosition"> + <short>Resets the Position to its maximum or minimum size</short> + <descr><printshort id="TCustomScrollBar.ClipPosition"/>. This is a helper + function used internally. The way it works is as follows. Say the Max Size + of the scrollbar is 10 and the current Position is 10. Now if the user + tries to scroll even further, 11 gets passed to the method. The ClipPosition + sees that 11 is past the Max value, so clips in back to 10. The oposite + is true for the Min value.</descr> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomScrollBar.ClipPosition.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.ClipPosition.APosition"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomScrollBar.UpdateBar"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: protected --> + <element name="TCustomScrollBar.DistributeEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomScrollBar.DistributeEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.DistributeEvent.Event"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomScrollBar.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomScrollBar.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomScrollBar.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomScrollBar.Orientation"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomScrollBar.Min"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomScrollBar.Max"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomScrollBar.PageSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomScrollBar.Position"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomScrollBar.SmallChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomScrollBar.LargeChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomScrollBar.OnChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomScrollBar.OnScroll"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomScrollBar.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBar.Create.AOwner"><short/></element> + <!-- procedure Visibility: public --> + <element name="TCustomScrollBar.LineUp"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TCustomScrollBar.LineDown"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TCustomScrollBar.PageUp"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TCustomScrollBar.PageDown"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TScrollBar"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TScrollBar.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TScrollBar.Orientation"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TScrollBar.Min"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TScrollBar.Max"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TScrollBar.PageSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TScrollBar.Position"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TScrollBar.SmallChange"> + <short>Determines how much <link id="TScrollBar.Position">Position</link> +changes when the user clicks the arrow buttons on the scroll bar or presses the +arrow keys on the keyboard.</short> + <descr> + <p>Set SmallChange to specify how much to change the value of Position +when the user clicks on the arrow buttons. The Max and Min properties define the +total range over which Position can vary.</p> + <p>For example, if Max is 100 and Min is 0, the scroll box can assume 100 +positions. If the SmallChange property setting is 5 and the Position property +is 0, the user can click the down or right arrow button 20 times before the +thumb tab is moved all the way to the end of the scroll bar.</p> + </descr> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TScrollBar.LargeChange"> + <short>Determines how much <link id="TScrollBar.Position">Position</link> +changes when the user clicks the scroll bar on either side of the thumb tab or +presses PgUp or PgDn.</short> + <descr> + <p>Set LargeChange to specify how much to change the value of +<link id="TScrollBar.Position">Position</link> when the user clicks on the side +of the thumb tab (that is, on the +thumb tab track, but not on the thumb tab itself). The Max and Min properties +define the total range over which Position can vary.</p> + <p>For example, if Max is 100 and Min is 0, the scroll box can assume 100 positions. + If the LargeChange property setting is 20 and the Position property is 0, the +user can click the scroll bar track five times after the thumb tab before it +moves all the way to the end of the scroll bar (100 / 20 = 5).</p> + </descr> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TScrollBar.OnChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TScrollBar.OnScroll"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TScrollingSupport"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TScrollingSupport.Parent"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TScrollingSupport.FBorders"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TScrollingSupport.FClientRect"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TScrollingSupport.FVirtualSize"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TScrollingSupport.FHorzScrollBar"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TScrollingSupport.FVertScrollBar"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TScrollingSupport.FOnClientRectChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- function Visibility: private --> + <element name="TScrollingSupport.EvMouseWheel"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TScrollingSupport.EvMouseWheel.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.EvMouseWheel.Event"><short/></element> + <!-- constructor Visibility: public --> + <element name="TScrollingSupport.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.Create.AParent"><short/></element> + <!-- destructor Visibility: public --> + <element name="TScrollingSupport.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TScrollingSupport.ProcessEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TScrollingSupport.ProcessEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.ProcessEvent.Event"><short/></element> + <!-- function Visibility: public --> + <element name="TScrollingSupport.DistributeEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TScrollingSupport.DistributeEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.DistributeEvent.Event"><short/></element> + <!-- function Visibility: public --> + <element name="TScrollingSupport.SendToChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TScrollingSupport.SendToChild.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.SendToChild.AChild"><short/></element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.SendToChild.Event"><short/></element> + <!-- procedure Visibility: public --> + <element name="TScrollingSupport.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TScrollingSupport.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TScrollingSupport.CalcClientSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TScrollingSupport.CalcClientSize.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.CalcClientSize.AHorzBarVisible"><short/></element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.CalcClientSize.AVertBarVisible"><short/></element> + <!-- procedure Visibility: public --> + <element name="TScrollingSupport.SetVirtualSize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.SetVirtualSize.ASize"><short/></element> + <!-- function Visibility: public --> + <element name="TScrollingSupport.ScrollPos"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TScrollingSupport.ScrollPos.Result"><short/></element> + <!-- procedure Visibility: public --> + <element name="TScrollingSupport.DefHorzScrollHandler"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.DefHorzScrollHandler.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.DefHorzScrollHandler.APosition"><short/></element> + <!-- procedure Visibility: public --> + <element name="TScrollingSupport.DefVertScrollHandler"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.DefVertScrollHandler.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TScrollingSupport.DefVertScrollHandler.APosition"><short/></element> + <!-- property Visibility: public --> + <element name="TScrollingSupport.Borders"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TScrollingSupport.ClientRect"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TScrollingSupport.HorzScrollBar"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TScrollingSupport.VertScrollBar"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TScrollingSupport.OnClientRectChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomScrollBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomScrollBox.ScrollingSupport"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomScrollBox.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBox.Paint.Canvas"><short/></element> + <!-- function Visibility: protected --> + <element name="TCustomScrollBox.ProcessEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomScrollBox.ProcessEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBox.ProcessEvent.Event"><short/></element> + <!-- function Visibility: protected --> + <element name="TCustomScrollBox.DistributeEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomScrollBox.DistributeEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBox.DistributeEvent.Event"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomScrollBox.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomScrollBox.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomScrollBox.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomScrollBox.Create.AOwner"><short/></element> + <!-- destructor Visibility: public --> + <element name="TCustomScrollBox.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TScrollBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomCheckbox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomCheckbox.SetChecked"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomCheckbox.SetChecked.AChecked"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomCheckbox.FChecked"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomCheckbox.FLabelPos"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomCheckbox.Click"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomCheckbox.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomCheckbox.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomCheckbox.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomCheckbox.Checked"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomCheckbox.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomCheckbox.Create.AOwner"><short/></element> + <!-- object Visibility: default --> + <element name="TCheckbox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TCheckbox.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TCheckbox.Checked"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TCheckbox.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TCheckbox.OnClick"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomRadioButton"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomRadioButton.SetChecked"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomRadioButton.SetChecked.AChecked"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomRadioButton.FChecked"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomRadioButton.FLabelPos"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomRadioButton.Click"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomRadioButton.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomRadioButton.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomRadioButton.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomRadioButton.Checked"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomRadioButton.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomRadioButton.Create.AOwner"><short/></element> + <!-- object Visibility: default --> + <element name="TRadioButton"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TRadioButton.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TRadioButton.Checked"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TRadioButton.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TRadioButton.OnClick"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomSeparator"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomSeparator.SetOrientation"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomSeparator.SetOrientation.AOrientation"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomSeparator.SetSpacing"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomSeparator.SetSpacing.ASpacing"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomSeparator.FOrientation"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomSeparator.FSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomSeparator.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomSeparator.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomSeparator.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomSeparator.Orientation"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomSeparator.Spacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomSeparator.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomSeparator.Create.AOwner"><short/></element> + <!-- object Visibility: default --> + <element name="TSeparator"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TSeparator.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TSeparator.Orientation"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TSeparator.Spacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomGroupBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomGroupBox.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGroupBox.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomGroupBox.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomGroupBox.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TGroupBox"> + <short>The TGroupBox widget provides a group box frame with a title</short> + <descr><printshort id="TGroupBox"/>. TGroupBox doesn't automatically lay out the child widgets (which are often TCheckBoxes or TRadioButtons but can be any widgets).</descr> + <seealso> + <link id="TCheckBox"/> + <link id="TRadioButton"/> + </seealso> + <example file="examples/TGroupBox.ex1.pas"/> + </element> + <!-- property Visibility: published --> + <element name="TGroupBox.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TGroupBox.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomListBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomListBox.FHotTrack"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomListBox.FItems"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomListBox.FItemIndex"> + <short/> + <descr/> + <seealso/> + </element> + <!-- function Visibility: private --> + <element name="TCustomListBox.EvMousePressed"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomListBox.EvMousePressed.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomListBox.EvMousePressed.Event"><short/></element> + <!-- function Visibility: private --> + <element name="TCustomListBox.EvMouseReleased"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomListBox.EvMouseReleased.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomListBox.EvMouseReleased.Event"><short/></element> + <!-- function Visibility: private --> + <element name="TCustomListBox.EvMouseMoved"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomListBox.EvMouseMoved.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomListBox.EvMouseMoved.Event"><short/></element> + <!-- function Visibility: private --> + <element name="TCustomListBox.ProcessMouseEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomListBox.ProcessMouseEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomListBox.ProcessMouseEvent.Event"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomListBox.ScrollingSupport"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomListBox.FMaxItemWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomListBox.ItemHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomListBox.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomListBox.Paint.Canvas"><short/></element> + <!-- function Visibility: protected --> + <element name="TCustomListBox.ProcessEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomListBox.ProcessEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomListBox.ProcessEvent.Event"><short/></element> + <!-- function Visibility: protected --> + <element name="TCustomListBox.DistributeEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomListBox.DistributeEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomListBox.DistributeEvent.Event"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomListBox.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomListBox.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomListBox.RecalcWidth"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomListBox.UpdateScrollBars"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomListBox.RedrawItem"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomListBox.RedrawItem.AIndex"><short/></element> + <!-- property Visibility: protected --> + <element name="TCustomListBox.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomListBox.CanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomListBox.HotTrack"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomListBox.ItemIndex"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomListBox.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomListBox.Create.AOwner"><short/></element> + <!-- destructor Visibility: public --> + <element name="TCustomListBox.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TCustomListBox.Items"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TListBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TListBox.OnClick"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TListBox.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TListBox.HotTrack"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TListBox.Items"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomComboBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomComboBox.ButtonClick"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomComboBox.ButtonClick.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomComboBox.DropDownDeactivate"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomComboBox.DropDownDeactivate.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomComboBox.DropDownDestroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomComboBox.DropDownDestroy.Sender"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomComboBox.FButton"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomComboBox.FDropDown"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomComboBox.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomComboBox.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomComboBox.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomComboBox.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: protected --> + <element name="TCustomComboBox.DistributeEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomComboBox.DistributeEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomComboBox.DistributeEvent.Event"><short/></element> + <!-- property Visibility: protected --> + <element name="TCustomComboBox.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomComboBox.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomComboBox.Create.AOwner"><short/></element> + <!-- object Visibility: default --> + <element name="TComboBox"> + <short>The TComboBox widget is a combined button and popup list.</short> + <descr> + <p>A TComboBox provides a means of presenting a list of options to the user in a way +that takes up the minimum amount of screen space.</p> + <p>A combobox is a selection widget that displays the current item, and can pop up a +list of selectable items. A combobox may be editable, allowing the user to modify each +item in the list.</p> + </descr> + <seealso> + <link id="TRadioButton"/> + <link id="TEdit"/> + </seealso> + <example file="examples/TComboBox.ex1.pas"/> + </element> + <!-- property Visibility: published --> + <element name="TComboBox.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TComboBox.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TComboBox.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="EInvalidGridOperation"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- set type Visibility: default --> + <element name="TGridDrawState"> + <short/> + <descr/> + <seealso/> + </element> + <!-- enumeration value Visibility: default --> + <element name="TGridDrawState.gdSelected"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TGridDrawState.gdFocused"><short/></element> + <!-- enumeration value Visibility: default --> + <element name="TGridDrawState.gdFixed"><short/></element> + <!-- pointer type Visibility: default --> + <element name="PIntegerArray"> + <short/> + <descr/> + <seealso/> + </element> + <!-- array type Visibility: default --> + <element name="TIntegerArray"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomGrid"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FColCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FRowCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FFixedCols"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FFixedRows"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FDefaultColWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FDefaultRowHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FGridWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FGridHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FFixedWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FFixedHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FColWidths"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomGrid.FRowHeights"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomGrid.SetColCount"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SetColCount.AColCount"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGrid.SetRowCount"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SetRowCount.ARowCount"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGrid.SetFixedCols"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SetFixedCols.AFixedCols"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGrid.SetFixedRows"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SetFixedRows.AFixedRows"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGrid.SetDefaultColWidth"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SetDefaultColWidth.AWidth"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGrid.SetDefaultRowHeight"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SetDefaultRowHeight.AHeight"><short/></element> + <!-- function Visibility: private --> + <element name="TCustomGrid.GetColWidths"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomGrid.GetColWidths.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.GetColWidths.ACol"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGrid.SetColWidths"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SetColWidths.ACol"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SetColWidths.AWidth"><short/></element> + <!-- function Visibility: private --> + <element name="TCustomGrid.GetRowHeights"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomGrid.GetRowHeights.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.GetRowHeights.ARow"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGrid.SetRowHeights"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SetRowHeights.ARow"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SetRowHeights.AHeight"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGrid.HorzScrollBarScroll"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.HorzScrollBarScroll.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.HorzScrollBarScroll.APosition"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomGrid.VertScrollBarScroll"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.VertScrollBarScroll.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.VertScrollBarScroll.APosition"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomGrid.ScrollingSupport"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomGrid.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.Paint.Canvas"><short/></element> + <!-- function Visibility: protected --> + <element name="TCustomGrid.ProcessEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomGrid.ProcessEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.ProcessEvent.Event"><short/></element> + <!-- function Visibility: protected --> + <element name="TCustomGrid.DistributeEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomGrid.DistributeEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.DistributeEvent.Event"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomGrid.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomGrid.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomGrid.ColWidthsChanged"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomGrid.DrawCell"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.DrawCell.ACanvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.DrawCell.ACol"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.DrawCell.ARow"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.DrawCell.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.DrawCell.AState"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomGrid.RowHeightsChanged"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomGrid.SizeChanged"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SizeChanged.OldColCount"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.SizeChanged.OldRowCount"><short/></element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.CanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.ColCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.RowCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.FixedCols"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.FixedRows"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.GridWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.GridHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.FixedWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.FixedHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.DefaultColWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.DefaultRowHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.ColWidths"> + <short/> + <descr/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.ColWidths.ACol"><short/></element> + <!-- property Visibility: protected --> + <element name="TCustomGrid.RowHeights"> + <short/> + <descr/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.RowHeights.ARow"><short/></element> + <!-- constructor Visibility: public --> + <element name="TCustomGrid.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGrid.Create.AOwner"><short/></element> + <!-- destructor Visibility: public --> + <element name="TCustomGrid.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure type Visibility: default --> + <element name="TDrawCellEvent"> + <short/> + <descr/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDrawCellEvent.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawCellEvent.ACanvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawCellEvent.ACol"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawCellEvent.ARow"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawCellEvent.Rect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawCellEvent.State"><short/></element> + <!-- object Visibility: default --> + <element name="TDrawGrid"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TDrawGrid.FOnDrawCell"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TDrawGrid.DrawCell"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TDrawGrid.DrawCell.ACanvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawGrid.DrawCell.ACol"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawGrid.DrawCell.ARow"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawGrid.DrawCell.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawGrid.DrawCell.AState"><short/></element> + <!-- function Visibility: public --> + <element name="TDrawGrid.CellRect"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDrawGrid.CellRect.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawGrid.CellRect.ACol"><short/></element> + <!-- argument Visibility: default --> + <element name="TDrawGrid.CellRect.ARow"><short/></element> + <!-- property Visibility: public --> + <element name="TDrawGrid.ColWidths"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TDrawGrid.RowHeights"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TDrawGrid.ColCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TDrawGrid.RowCount"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TDrawGrid.FixedCols"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TDrawGrid.FixedRows"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TDrawGrid.DefaultColWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TDrawGrid.DefaultRowHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TDrawGrid.OnDrawCell"> + <short/> + <descr/> + <seealso/> + </element> + <!-- pointer type Visibility: default --> + <element name="PCells"> + <short/> + <descr/> + <seealso/> + </element> + <!-- array type Visibility: default --> + <element name="TCells"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TStringGrid"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TStringGrid.CellStrings"> + <short/> + <descr/> + <seealso/> + </element> + <!-- function Visibility: private --> + <element name="TStringGrid.GetCells"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStringGrid.GetCells.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.GetCells.ACol"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.GetCells.ARow"><short/></element> + <!-- procedure Visibility: private --> + <element name="TStringGrid.SetCells"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStringGrid.SetCells.ACol"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.SetCells.ARow"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.SetCells.AValue"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TStringGrid.SizeChanged"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStringGrid.SizeChanged.OldColCount"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.SizeChanged.OldRowCount"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TStringGrid.DrawCell"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStringGrid.DrawCell.ACanvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.DrawCell.ACol"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.DrawCell.ARow"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.DrawCell.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.DrawCell.AState"><short/></element> + <!-- constructor Visibility: public --> + <element name="TStringGrid.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStringGrid.Create.AOwner"><short/></element> + <!-- destructor Visibility: public --> + <element name="TStringGrid.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TStringGrid.Cells"> + <short/> + <descr/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStringGrid.Cells.ACol"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.Cells.ARow"><short/></element> + <!-- property Visibility: public --> + <element name="TStringGrid.Cols"> + <short/> + <descr/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStringGrid.Cols.Index"><short/></element> + <!-- property Visibility: public --> + <element name="TStringGrid.Objects"> + <short/> + <descr/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStringGrid.Objects.ACol"><short/></element> + <!-- argument Visibility: default --> + <element name="TStringGrid.Objects.ARow"><short/></element> + <!-- property Visibility: public --> + <element name="TStringGrid.Rows"> + <short/> + <descr/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStringGrid.Rows.Index"><short/></element> + <!-- object Visibility: default --> + <element name="TCustomForm"> + <short>TCustomForm is a base class from which to derive a window such as a form or dialog.</short> + <descr>Derive from TCustomForm to create a custom window. The TCustomForm +descendant can contain other objects, such as TButton, TCheckBox and +TComboBox objects, but they have to be placed into a Layout Manager class.</descr> + <seealso> + <link id="TBoxLayout"/> + <link id="TFixedLayout"/> + <link id="TGridLayout"/> + </seealso> + </element> + <!-- variable Visibility: private --> + <element name="TCustomForm.FFocusedWidget"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomForm.FMouseCaptureWidget"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomForm.FLastSetCursor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomForm.FWnd"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomForm.FWindowType"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomForm.FOnCreate"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomForm.FOnDestroy"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomForm.FOnActivate"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomForm.FOnDeactivate"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.SetFocusedWidget"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.SetFocusedWidget.AWidget"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.SetMouseCaptureWidget"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.SetMouseCaptureWidget.AWidget"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndClose"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndClose.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndFocusIn"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndFocusIn.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndFocusOut"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndFocusOut.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndHide"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndHide.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndKeyPressed"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndKeyPressed.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndKeyPressed.AKey"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndKeyPressed.AShift"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndKeyReleased"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndKeyReleased.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndKeyReleased.AKey"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndKeyReleased.AShift"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndKeyChar"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndKeyChar.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndKeyChar.AKeyChar"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndMouseEnter"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseEnter.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseEnter.AShift"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseEnter.AMousePos"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndMouseLeave"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseLeave.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndMouseMoved"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseMoved.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseMoved.AShift"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseMoved.AMousePos"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndMousePressed"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMousePressed.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMousePressed.AButton"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMousePressed.AShift"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMousePressed.AMousePos"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndMouseReleased"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseReleased.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseReleased.AButton"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseReleased.AShift"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseReleased.AMousePos"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndMouseWheel"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseWheel.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseWheel.AShift"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseWheel.AWheelDelta"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMouseWheel.AMousePos"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndPaint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndPaint.Sender"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndPaint.ARect"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndMove"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndMove.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndResize"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndResize.Sender"><short/></element> + <!-- procedure Visibility: private --> + <element name="TCustomForm.WndShow"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WndShow.Sender"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomForm.FBorderWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomForm.FIsActive"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomForm.FResizedByUser"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomForm.FPositionSpecified"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomForm.Loaded"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomForm.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.Paint.Canvas"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomForm.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: protected --> + <element name="TCustomForm.WidgetCoords"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomForm.WidgetCoords.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.WidgetCoords.AWidget"><short/></element> + <!-- function Visibility: protected --> + <element name="TCustomForm.ProcessEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomForm.ProcessEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomForm.ProcessEvent.Event"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomForm.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomForm.EvTextChanged"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomForm.CreateWnd"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomForm.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomForm.CanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomForm.Cursor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomForm.BorderWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomForm.WindowType"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomForm.OnCreate"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomForm.OnDestroy"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomForm.OnActivate"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomForm.OnDeactivate"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomForm.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.Create.AOwner"><short/></element> + <!-- destructor Visibility: public --> + <element name="TCustomForm.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TCustomForm.Show"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TCustomForm.Close"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TCustomForm.SetPosition"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomForm.SetPosition.APosition"><short/></element> + <!-- property Visibility: public --> + <element name="TCustomForm.FocusedWidget"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TCustomForm.IsActive"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TCustomForm.MouseCaptureWidget"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TCustomForm.Wnd"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TForm"> + <short>A descendant of TCustomForm with published properties</short> + <descr><printshort id="TForm"/>.</descr> + <seealso><link id="TCustomForm"/></seealso> + </element> + <!-- property Visibility: published --> + <element name="TForm.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TForm.BorderWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TForm.WindowType"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TForm.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TForm.OnCreate"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TCustomStandardDialog"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomStandardDialog.StdBtnClicked"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomStandardDialog.StdBtnClicked.Sender"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomStandardDialog.FButtons"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomStandardDialog.MainLayout"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomStandardDialog.BtnLayout"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TCustomStandardDialog.Separator"> + <short/> + <descr/> + <seealso/> + </element> + <!-- function Visibility: protected --> + <element name="TCustomStandardDialog.ProcessEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomStandardDialog.ProcessEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomStandardDialog.ProcessEvent.Event"><short/></element> + <!-- function Visibility: protected --> + <element name="TCustomStandardDialog.DistributeEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomStandardDialog.DistributeEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomStandardDialog.DistributeEvent.Event"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TCustomStandardDialog.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomStandardDialog.Resized"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomStandardDialog.SetButtons"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomStandardDialog.SetButtons.AButtons"><short/></element> + <!-- property Visibility: protected --> + <element name="TCustomStandardDialog.Buttons"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomStandardDialog.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomStandardDialog.Create.AOwner"><short/></element> + <!-- object Visibility: default --> + <element name="TStandardDialog"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TStandardDialog.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TStandardDialog.OnCreate"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TStandardDialog.Buttons"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TApplication"> + <short>The TApplication class manages the GUI application's control flow and main settings</short> + <descr><printshort id="TApplication"/>. For any GUI application that uses fpGUI, there is precisely +one TApplication object, no matter whether the application has 0, 1, 2 or more windows at +any time.</descr> + </element> + <!-- variable Visibility: private --> + <element name="TApplication.FDisplay"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TApplication.FForms"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TApplication.FDefaultStyle"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TApplication.FTitle"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: protected --> + <element name="TApplication.XMLDoc"> + <short/> + <descr/> + <seealso/> + </element> + <!-- function Visibility: protected --> + <element name="TApplication.GetDefaultStyle"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TApplication.GetDefaultStyle.Result"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TApplication.SetTitle"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TApplication.SetTitle.ATitle"><short/></element> + <!-- constructor Visibility: public --> + <element name="TApplication.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- destructor Visibility: public --> + <element name="TApplication.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TApplication.SetupXMLStreaming"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TApplication.SetupXMLStreaming.AXMLFilename"><short/></element> + <!-- procedure Visibility: public --> + <element name="TApplication.CreateForm"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TApplication.CreateForm.InstanceClass"><short/></element> + <!-- argument Visibility: default --> + <element name="TApplication.CreateForm.Reference"><short/></element> + <!-- procedure Visibility: public --> + <element name="TApplication.AddForm"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TApplication.AddForm.AForm"><short/></element> + <!-- procedure Visibility: public --> + <element name="TApplication.Run"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TApplication.Display"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TApplication.DefaultStyle"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TApplication.Title"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: default --> + <element name="Application"> + <short>Global TApplication instance</short> + <descr><printshort id="Application"/> + is a object that holds all the different parts +together. It stores the instance variables for the TStyle, TScreen, etc.</descr> + </element> + <!-- function Visibility: default --> + <element name="Min"> + <short>Returns the smallest value of the two</short> + </element> + <!-- function result Visibility: default --> + <element name="Min.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="Min.a"><short/></element> + <!-- argument Visibility: default --> + <element name="Min.b"><short/></element> + <!-- function Visibility: default --> + <element name="Max"> + <short>Returns the greater of two values.</short> + </element> + <!-- function result Visibility: default --> + <element name="Max.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="Max.a"><short/></element> + <!-- argument Visibility: default --> + <element name="Max.b"><short/></element> + <!-- function Visibility: default --> + <element name="ClipMinMax"> + <short>Clip the value until it is between min and max</short> + <descr><printshort id="ClipMinMax"/>. It is currently used internally in the TScrollBarSlider.EvMouseMove to +limit the amount the user can scroll the scrollbar thumb button.</descr> + </element> + <!-- function result Visibility: default --> + <element name="ClipMinMax.Result"> + <short>the clipped result value</short> + </element> + <!-- argument Visibility: default --> + <element name="ClipMinMax.val"> + <short>value to be tested</short> + </element> + <!-- argument Visibility: default --> + <element name="ClipMinMax.min"> + <short>minimum allowed value</short> + </element> + <!-- argument Visibility: default --> + <element name="ClipMinMax.max"> + <short>maximum allowed value</short> + </element> + <!-- procedure Visibility: public --> + <element name="TStyle.Draw3DFrame"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.Draw3DFrame.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.Draw3DFrame.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.Draw3DFrame.Color1"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.Draw3DFrame.Color2"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.Draw3DFrame.Color3"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.Draw3DFrame.Color4"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawFocusRect"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawFocusRect.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawFocusRect.ARect"><short/></element> + <!-- procedure Visibility: public --> + <element name="TStyle.DrawSunkenOuterBorder"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawSunkenOuterBorder.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.DrawSunkenOuterBorder.ARect"><short/></element> + <!-- object Visibility: default --> + <element name="TMotifStyle"> + <short>The TMotifStyle class provides Motif look and feel.</short> + <descr>This class implements the Motif look and feel. It closely resembles the +original Motif look as defined by the Open Group, but with some minor +improvements. The Motif style is fpGUI's default GUI style on Unix platforms.</descr> + <seealso> + <link id="TDefaultStyle"/> + <link id="TStyle"/> + </seealso> + </element> + <!-- procedure Visibility: public --> + <element name="TMotifStyle.DrawFocusRect"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMotifStyle.DrawFocusRect.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TMotifStyle.DrawFocusRect.ARect"><short/></element> + <!-- procedure Visibility: public --> + <element name="TMotifStyle.DrawButtonFace"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMotifStyle.DrawButtonFace.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TMotifStyle.DrawButtonFace.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TMotifStyle.DrawButtonFace.Flags"><short/></element> + <!-- procedure Visibility: public --> + <element name="TMotifStyle.DrawCheckBox"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMotifStyle.DrawCheckBox.Canvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TMotifStyle.DrawCheckBox.ARect"><short/></element> + <!-- argument Visibility: default --> + <element name="TMotifStyle.DrawCheckBox.LabelRect"><short/></element> + <!-- argument Visibility: default --> + <element name="TMotifStyle.DrawCheckBox.Flags"><short/></element> + <!-- procedure Visibility: private --> + <element name="TWidget.SetStyle"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TWidget.SetStyle.AValue"><short/></element> + <!-- constructor Visibility: public --> + <element name="TCustomLabel.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomLabel.Create.pText"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomLabel.Create.pOwner"><short/></element> + <!-- variable Visibility: private --> + <element name="TCustomEdit.FSelStart"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomEdit.FSelOffset"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomEdit.SetText"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.SetText.AText"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.Create.pText"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.Create.pOwner"><short/></element> + <!-- constructor Visibility: public --> + <element name="TCustomButton.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomButton.Create.pText"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomButton.Create.pOwner"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomCheckbox.Create.pText"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomCheckbox.Create.pOwner"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomRadioButton.Create.pText"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomRadioButton.Create.pOwner"><short/></element> + <!-- property Visibility: published --> + <element name="TRadioButton.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TRadioButton.CanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TCustomGroupBox.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGroupBox.Create.pText"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomGroupBox.Create.pOwner"><short/></element> + <!-- property Visibility: published --> + <element name="TGroupBox.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TGroupBox.CanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TListBox.ItemIndex"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomComboBox.FItemIndex"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomComboBox.FItems"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomComboBox.FOnChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomComboBox.SetItemIndex"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomComboBox.SetItemIndex.AValue"><short/></element> + <!-- variable Visibility: protected --> + <element name="TCustomComboBox.lbl"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomComboBox.ItemIndex"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: protected --> + <element name="TCustomComboBox.OnChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- destructor Visibility: public --> + <element name="TCustomComboBox.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: public --> + <element name="TCustomComboBox.Items"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TComboBox.CanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TComboBox.ItemIndex"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TComboBox.OnChange"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TDrawGrid.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TDrawGrid.CanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TApplication.SetStyle"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TApplication.SetStyle.pNewStyle"><short/></element> + <!-- object Visibility: default --> + <element name="TMenuItem"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TMenuBar"> + <short>A container for TMenuItem objects</short> + </element> + <!-- constructor Visibility: public --> + <element name="TMenuBar.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMenuBar.Create.AOwner"><short/></element> + <!-- destructor Visibility: public --> + <element name="TMenuBar.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TMenuBar.AddMenu"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMenuBar.AddMenu.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuBar.AddMenu.pTitle"><short/></element> + <!-- constructor Visibility: public --> + <element name="TMenuItem.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMenuItem.Create.pTitle"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuItem.Create.pOwner"><short/></element> +<!-- argument Visibility: default --> +<element name="TMenuItem.Create.AOwner"> +<short></short> +</element> + <!-- constant Visibility: default --> + <element name="clRed"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clGreen"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clBlue"> + <short/> + <descr/> + <seealso/> + </element> + <!-- function Visibility: public --> + <element name="TStyle.GetMenuBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TStyle.GetMenuBorders.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetMenuBorders.pCanvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetMenuBorders.pText"><short/></element> + <!-- argument Visibility: default --> + <element name="TStyle.GetMenuBorders.pTextWidth"><short/></element> + <!-- function Visibility: public --> + <element name="TDefaultStyle.GetMenuBorders"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TDefaultStyle.GetMenuBorders.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetMenuBorders.pCanvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetMenuBorders.pText"><short/></element> + <!-- argument Visibility: default --> + <element name="TDefaultStyle.GetMenuBorders.pTextWidth"><short/></element> + <!-- variable Visibility: private --> + <element name="TCustomLabel.FFontColor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomLabel.SetFontColor"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomLabel.SetFontColor.AValue"><short/></element> + <!-- property Visibility: protected --> + <element name="TCustomLabel.FontColor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TLabel.FontColor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TCustomEdit.FFontColor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomEdit.SetFontColor"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.SetFontColor.AValue"><short/></element> + <!-- property Visibility: protected --> + <element name="TCustomEdit.FontColor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TEdit.FontColor"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMenuItem.FHandler"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMenuItem.FHotKeyDef"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMenuItem.FItems"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMenuItem.FSeparator"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TMenuItem.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- destructor Visibility: public --> + <element name="TMenuItem.Destroy"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TMenuItem.OnClick"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TMenuItem.Separator"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TMenuItem.HotKeyDef"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TMenuItem.Text"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TMenuItem.Visible"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TMenuItem.Enabled"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMenuBar.FItems"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMenuBar.FFocusItem"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TMenuBar.FHorzSpacing"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TMenuBar.CalcSizes"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TMenuBar.Paint"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMenuBar.Paint.Canvas"><short/></element> + <!-- function Visibility: protected --> + <element name="TMenuBar.VisibleCount"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMenuBar.VisibleCount.Result"><short/></element> + <!-- function Visibility: protected --> + <element name="TMenuBar.VisibleItem"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMenuBar.VisibleItem.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuBar.VisibleItem.idx"><short/></element> + <!-- procedure Visibility: protected --> + <element name="TMenuBar.DrawColumn"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMenuBar.DrawColumn.pCanvas"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuBar.DrawColumn.col"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuBar.DrawColumn.focus"><short/></element> + <!-- function Visibility: protected --> + <element name="TMenuBar.DistributeEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMenuBar.DistributeEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuBar.DistributeEvent.Event"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuBar.AddMenu.pHotKeyDef"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuBar.AddMenu.pHandlerProc"><short/></element> + <!-- procedure Visibility: public --> + <element name="TCustomGridLayout.RemoveChild"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomGridLayout.RemoveChild.AChild"><short/></element> + <!-- property Visibility: published --> + <element name="TForm.OnDestroy"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TForm.OnActivate"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TForm.OnDeactivate"> + <short/> + <descr/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TPopupWindow"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- constructor Visibility: public --> + <element name="TPopupWindow.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TPopupWindow.Create.AOwner"><short/></element> + <!-- procedure Visibility: public --> + <element name="TPopupWindow.Show"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- procedure Visibility: public --> + <element name="TPopupWindow.Close"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- object Visibility: default --> + <element name="TComboBoxPopup"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TComboBoxPopup.FListBox"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TComboBoxPopup.ItemSelected"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TComboBoxPopup.ItemSelected.Sender"><short/></element> + <!-- constructor Visibility: public --> + <element name="TComboBoxPopup.Create"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TComboBoxPopup.Create.AOwner"><short/></element> + <!-- property Visibility: public --> + <element name="TComboBoxPopup.ListBox"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: protected --> + <element name="TCustomComboBox.Click"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clCyan"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clYellow"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clMoneyGreen"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clSkyBlue"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clCream"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clMedGray"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clForestGreen"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clRoyalBlue"> + <short/> + <descr/> + <seealso/> + </element> + <!-- constant Visibility: default --> + <element name="clMagenta"> + <short/> + <descr/> + <seealso/> + </element> + <!-- procedure Visibility: private --> + <element name="TCustomEdit.DoMousePressed"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.DoMousePressed.pEvent"><short/></element> + <!-- function Visibility: protected --> + <element name="TCustomEdit.ProcessEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TCustomEdit.ProcessEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TCustomEdit.ProcessEvent.Event"><short/></element> + <!-- property Visibility: published --> + <element name="TCheckbox.CanExpandHeight"> + <short/> + <descr/> + <seealso/> + </element> + <!-- property Visibility: published --> + <element name="TCheckbox.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + <!-- variable Visibility: private --> + <element name="TApplication.FUserStyle"> + <short/> + <descr/> + <seealso/> + </element> + <!-- function Visibility: protected --> + <element name="TMenuItem.ProcessEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMenuItem.ProcessEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuItem.ProcessEvent.pEvent"><short/></element> + <!-- procedure Visibility: private --> + <element name="TMenuBar.DoMouseEnter"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMenuBar.DoMouseEnter.pEvent"><short/></element> + <!-- procedure Visibility: private --> + <element name="TMenuBar.DoMouseLeave"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMenuBar.DoMouseLeave.pEvent"><short/></element> + <!-- procedure Visibility: private --> + <element name="TMenuBar.DoMouseMove"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- argument Visibility: default --> + <element name="TMenuBar.DoMouseMove.pEvent"><short/></element> + <!-- function Visibility: private --> + <element name="TMenuBar.CalcMouseCol"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMenuBar.CalcMouseCol.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuBar.CalcMouseCol.x"><short/></element> + <!-- function Visibility: protected --> + <element name="TMenuBar.ProcessEvent"> + <short/> + <descr/> + <errors/> + <seealso/> + </element> + <!-- function result Visibility: default --> + <element name="TMenuBar.ProcessEvent.Result"><short/></element> + <!-- argument Visibility: default --> + <element name="TMenuBar.ProcessEvent.pEvent"><short/></element> + <!-- property Visibility: published --> + <element name="TMenuBar.CanExpandWidth"> + <short/> + <descr/> + <seealso/> + </element> + </module> + <!-- fpGUI --> + </package> +</fpdoc-descriptions> diff --git a/docs/xml/imageio_de.xml b/docs/xml/imageio_de.xml new file mode 100644 index 00000000..cdf6fcca --- /dev/null +++ b/docs/xml/imageio_de.xml @@ -0,0 +1,722 @@ +<?xml version="1.0" encoding="ISO8859-1"?> +<fpdoc-descriptions> + +<!-- + ==================================================================== + ImageIO + ==================================================================== +--> + +<module name="ImageIO"> +<short>Bilddateien Lesen und Schreiben</short> +<descr> +<p>Die Unit <var>ImageIO</var> definiert einige Basisklassen für das allgemeine +Lesen und Schreiben von Bilddateien. Um ein spezielles Dateiformat zu +unterstützen, ist die entsprechende Basisklasse abzuleiten.</p> +<p>Derzeit wird nur das Lesen von Bildern unterstützt. Die entsprechende +Basisklasse heißt <link id="TImageReader"/>. Unterstützung für das Schreiben +von vorhandenen Bilddaten in eine Datei oder einen Stream wird in einer +zukünftigen Version hinzugefügt.</p> +<p>Diese Unit ist weitesgehendst unabhängig von anderen Paketen. Auch von fpGFX +werden nur Deklarationen übernommen, es wird aber kein Code verwendet. Dies +ermöglicht eine sehr flexible und effiziente Nutzung von <var>ImageIO</var> +für allerlei spezielle Anwendungen. Komfortfunktionen für die Nutzung mit +fpGFX sind in der Unit <link id="fpImg"/> zu finden.</p> +<p>fpImg ist (c) 2000 Areca Systems GmbH / Sebastian Günther +(sg@freepascal.org). Alle Rechte vorbehalten.</p> +</descr> + +<element name="SysUtils"> <!-- Unit-Verweis --> +<short>Unterstützung für <link id="SysUtils.Exception">Exceptions</link></short> +</element> + +<element name="Classes"> <!-- Unit-Verweis --> +<short>Unterstützung für <link id="Classes.TStream">Streams</link></short> +</element> + +<element name="GFXBase"> <!-- Unit-Verweis --> +<short>Deklarationen für <link id="GFXBase.TGfxPixelFormat">Pixelformate</link> +und <link id="GFXBase.TGfxPalette">Farbpaletten</link></short> +</element> + +<!-- + ******************************************************************** + EImgError + ******************************************************************** +--> + +<element name="EImgError"> <!-- Klasse --> +<short>Allgemeine Fehler-Exception für <var>ImageIO</var></short> +<descr> +Alle speziellen Exceptions, die in <var>ImageIO</var> oder seinen Lese- und +Schreibroutinen auftreten können, sind von <var>EImgError</var> abgeleitet. +Diese Klasse betrifft allerdings nur spezifische Fehlersituationen; allgemeine +Fehlerbedingungen, wie Schutzverletzungen etc., werden über die gewohnten +Standard-Exceptions gemeldet. +</descr> +</element> + +<!-- + ******************************************************************** + EImgOutOfData + ******************************************************************** +--> + +<element name="EImgOutOfData"> <!-- Klasse --> +<short>Zuwenig Daten für Bild verfügbar</short> +<descr> +<p>Ein Bild-Lese-Objekt (<link id="TImageReader"/>) kann diesen Fehler melden, +wenn es Daten lesen soll, aber keine weiteren Daten zur Verfügung stehen.</p> +<p>Auf die Anforderung hin, Daten zu lesen, erwartet der Leser auch +entsprechende Daten. Es ist erforderlich, daß mindestens ein Byte an Daten zu +lesen ist. Ist dies nicht der Fall, wird diese Exception ausgelöst.</p> +</descr> +<seealso> + <link id="TImageReader"/> +</seealso> +</element> + +<element name="EImgOutOfData.Create"> <!-- Konstruktur --> +<short>Initialisierung mit passendem Fehlertext</short> +<descr> +Dieser Konstruktur dient nur zur bequemeren Programmierung: Er initialisiert +die Exception automatisch mit dem passenden Fehlertext. +</descr> +</element> + +<!-- + ******************************************************************** + EImgUnsupportedPixelFormat + ******************************************************************** +--> + +<element name="EImgUnsupportedPixelFormat"> <!-- Klasse --> +<short>Pixelformat wird nicht unterstützt</short> +<descr> +Diese Exception wird von Bildlese- oder Schreibklassen ausgelöst, wenn sie mit +einem Pixelformat konfrontiert werden, welches sie nicht unterstützen (Lesen) +oder nicht unterstützen können (zugrunde liegendes Dateiformat kennt das +geforderte Pixelformat nicht). +</descr> +</element> + +<element name="EImgUnsupportedPixelFormat.Create"> <!-- Konstruktur --> +<short>Initialisierung mit passendem Fehlertext</short> +<descr> +Dieser Konstruktur dient nur zur bequemeren Programmierung: Er initialisiert +die Exception automatisch mit dem passenden Fehlertext. +</descr> +</element> + +<element name="TImageReaderClass"> <!-- "class of" Typ --> +<short>Klassentyp für <link id="TImageReader"/></short> +<descr> +Diese Typdeklaration definiert einen Namen für alle Klassen vom Typ +<link id="TImageReader"/>. Um beispielsweise in einer Variable den Typ +einer Bildlese-Klasse zu speichern, muß diese Variable einfach als vom Typ +<var>TImageReaderClass</var> deklariert werden. +</descr> +<seealso> + <link id="TImageReader"/>. +</seealso> +</element> + +<element name="TImageReaderState"> <!-- Aufzählungstyp --> +<short>Zustandswerte für <link id="TImageReader">Bildleser</link></short> +<descr> +Dieser Typ zählt die verschiedenen möglichen Zustände für einen +<link id="TImageReader">Bildleser</link> auf. Während ein Bild eingelesen wird, +wird der Zustand an bestimmten Punkten um eine Stufe erhöht. +</descr> +<seealso> + <link id="TImageReader"/> +</seealso> +</element> + +<element name="TImageReaderState.irsStart"> <!-- Aufzählungswert --> +<short>Leser hat noch nichts getan</short> +</element> + +<element name="TImageReaderState.irsInHeader"> <!-- Aufzählungswert --> +<short>Leser verarbeitet gerade den Header</short> +</element> + +<element name="TImageReaderState.irsHeaderRead"> <!-- Aufzählungswert --> +<short>Leser hat den Header fertig eingelesen</short> +</element> + +<element name="TImageReaderState.irsInImage"> <!-- Aufzählungswert --> +<short>Leser liest gerade die Bilddaten ein</short> +</element> + +<element name="TImageReaderState.irsFinished"> <!-- Aufzählungswert --> +<short>Leser hat seine Arbeit beendet; Header und Bild sind komplett eingelesen.</short> +</element> + +<element name="TSegmentEvent"> <!-- Prozedur-Typ --> +<short>'Segment gelesen' Ereignistyp</short> +<descr> +Dieser Typ definiert ein Ereignis, welches besagt, daß der Sender ein +Bildsegment erfolgreich fertig eingelesen hat. Die Argumente <var>StartY</var> +und <var>Height</var> geben Auskunft darüber, welchen Teil des gesamten Bildes +das gelesene Segment darstellt. +</descr> +<seealso> + <link id="TImageReader.OnSegment"/> +</seealso> +</element> + +<element name="TSegmentEvent.Sender"> <!-- Argument --> +<short>Auslöser des Ereignisses</short> +</element> + +<element name="TSegmentEvent.StartY"> <!-- Argument --> +<short>Y-Start-Koordinate des Segmentes</short> +</element> + +<element name="TSegmentEvent.Height"> <!-- Argument --> +<short>Höhe des Segmentes in Pixel</short> +</element> + +<!-- + ******************************************************************** + TImageReader + ******************************************************************** +--> + +<element name="TImageReader"> <!-- Klasse --> +<short>Basisklasse für Bildleser</short> +<descr> +<p>Diese Klasse stellt die Basisklasse für alle Bildleser dar. Wie der Name +sagt, ist ein Bildleser eine Klasse, welche Bilder (Images) einlesen kann.</p> +<p>Durch die gemeinsame Basisklasse gibt es eine gemeinsame Schnittstelle, so +daß verschiedene Leser in Anwendungen sehr leicht ausgetauscht werden können. +Für speziellere Anwendungen kann jeder Bildleser problemlos weitere Fähigkeiten +anbieten; hierbei entfällt dann aber der Vorteil der Austauschbarkeit.</p> +<p>Alle Daten werden aus einem <link id="Classes.TStream">Stream-Objekt</link> +geladen. Eine weitere Besonderheit ist die Anforderung an alle Leser, daß sie +asynchrones Lesen unterstützen müssen: Der Lesevorgang muß sich nach einer +beliebigen Zahl von gelesenen Bytes unterbrechen und zu einem späteren Zeitpunkt +wieder fortführen lassen.</p> + +<section> +<title>Der Einlese-Vorgang aus der Sicht von außen</title> +<p>Die äußere Anwendung, welche den Leser verwenden will, sollte folgende Dinge +beachten:</p> + +<ul> + +<li><p>Zunächst wird der Header eingelesen. Dazu wird solange die Methode +<link id="TImageReader.ProcessHeaderData"/> aufgerufen, bis der Header +vollständig eingelesen wurde. Die Fertigstellung läßt sich über den aktuellen +Zustand (<link id="TImageReader.State"/>) oder über ein entsprechendes +Ereignis (<link id="TImageReader.OnHeader"/>) prüfen.</p></li> + +<li><p>Die Anwendung kann nun entscheiden, ob sie die eigentlichen Bilddaten +lesen will oder nicht. Ein Abbrechen an dieser Stelle ist problemlos +möglich. Desweiteren können ab diesem Zeitpunkt die Eigenschaften des Bildes +über die entsprechenden Eigenschaften des Objekts abgefragt werden.</p></li> + +<li><p>Das Bild selbst kann auf Wunsch in mehreren Schritten, sogenannten +<em>Segmenten</em> eingelesen werden. Ein Segment ist einfach ein vertikaler +Abschnitt des Bildes.<br/>Ein Segment muß initialisiert werden, und zwar zu +Beginn des Einlese-Vorgangs und, auf Wunsch, nachdem ein einzelnes Segment +fertig gelesen wurde. Hierzu dient die Methode +<link id="TImageReader.SetImageSegmentBuffer"/>. Bemerkenswert hierbei ist, +daß der Aufrufer den Speicher für das Bild verwaltet.</p></li> + +<li><p>Um herauszufinden, an welcher Stelle das nächste zu lesende Segment +liegen wird, sollte die Methode <link id="TImageReader.GetImageSegmentStartY"/> +befragt werden. Dies ist nur dann nicht notwendig, falls das Bild in nur einem +Segment gelesen werden soll - hier würde immer der Wert "0" zurückgeliefert +werden.</p></li> + +<li><p>Wenn der Leser Bilddaten lesen soll, ist dazu einfach die Methode +<link id="TImageReader.ProcessImageData"/> aufzurufen. Diese Methode liest +solange Daten, solange welche verfügbar sind oder das Bild fertig eingelesen +wurde.</p></li> + +<li><p>Sobald ein Segment fertig gelesen wurde, wird das Ereignis +<link id="TImageReader.OnSegment"/> ausgelöst.</p></li> + +<li><p>Wurde das gesamte Bild fertig eingelesen, wird das Ereignis +<link id="TImageReader.OnImage"/> ausgelöst.</p></li> + +</ul> +</section> + +<section> +<title>Der Einlese-Vorgang aus der Sicht des Lesers</title> +<p>Für die Implementierung von abgeleitete Klassen, welche ein konkretes +Bildformat lesen können, sind folgende Punkte zu beachten:</p> +<ul> +<li><p>Üblicherweise wird kein neuer <link id="TImageReader.Create">Konstruktur +</link> benötigt. Es spricht zwar auch nichts dagegen; aber die Präsenz eines +virtuellen Konstruktors in dieser Basisklasse mag für manchen so erscheinen, +als sei dies notwendig. Dies ist nicht der Fall.</p></li> +<li><p>Die Verwaltung des aktuellen Zustandes (<link id="TImageReader.State"/>) +wird bereits komplett von der Basisklasse übernommen</p></li> +<li><p>Die Methode <link id="TImageReader.DoProcessHeaderData"/> muß auf jeden +Fall überschrieben werden; sie dient zum Lesen und zur Auswertung des +Bild-Headers. Sobald der Header fertig eingelesen wurde und die entsprechenden +Informations-Eigenschaften gesetzt wurden, muß die neue Methode die Methode +<link id="TImageReader.HeaderFinished"/> aufrufen.</p></li> +<li><p>Die Methode <link id="TImageReader.DoGetImageSegmentStartY"/> muß +überschrieben werden; sie kann vor dem Lesen eines Segmentes aufgerufen werden, +solange es noch Segmente zu lesen gibt.</p></li> +<li><p>Die Methode <link id="TImageReader.InitImageReading"/> kann überschrieben +werden, wenn der Bildleser vor Beginn des Einlesens der eigentlichen Bilddaten +noch spezielle Vorbereitungen zu treffen hat.</p></li> +<li><p>Die Methode <link id="TImageReader.DoProcessHeaderData"/> wird in +abgeleiteten Klassen überschrieben, um Bilddaten einlesen zu können. Immer dann, +wenn ein Segment eingelesen wurde, muß die neue Methode die Methode +<link id="TImageReader.SegmentFinished"/> aufrufen; entsprechend muß +<link id="TImageReader.ImageFinished"/> aufgerufen werden, sobald das Bild +vollständig eingelesen wurde.</p></li> +</ul> +</section> +</descr> + +<errors> +Trifft der Leser im Header auf ein Pixelformat, welches er nicht verarbeiten +kann, so löst er eine <link id="EImgUnsupportedPixelFormat"/> Exception aus. +<br/> +Wird <link id="TImageReader.ProcessHeaderData"/> oder +<link id="TImageReader.ProcessImageData"/> aufgerufen und es können vom +Eingabe-Datenstrom keine Daten gelesen werden, so wird die Exception +<link id="EImgOutOfData"/> ausgelöst. +</errors> +</element> + +<element name="TImageReader.FWidth"> <!-- Variable --> +<short>Breite des Bildes</short> +<descr> +Dieses Feld gibt die Breite des Bildes in Pixeln an. Es darf nur innerhalb von +<link id="TImageReader.DoProcessHeaderData"/> gesetzt werden. +</descr> +<seealso> + <link id="TImageReader.Width"/> +</seealso> +</element> + +<element name="TImageReader.FHeight"> <!-- Variable --> +<short>Höhe des Bildes</short> +<descr> +Dieses Feld gibt die Höhe des Bildes in Pixeln an. Es darf nur innerhalb von +<link id="TImageReader.DoProcessHeaderData"/> gesetzt werden. +</descr> +<seealso> + <link id="TImageReader.Height"/> +</seealso> +</element> + +<element name="TImageReader.FPixelFormat"> <!-- Variable --> +<short>Pixelformat des Bildes</short> +<descr> +Dieses Feld beschreibt das Pixelformat, in welchem die Pixeldaten +vorliegen. Es darf nur innerhalb von +<link id="TImageReader.DoProcessHeaderData"/> gesetzt werden. +</descr> +<seealso> + <link id="TImageReader.PixelFormat"/> +</seealso> +</element> + +<element name="TImageReader.HeaderFinished"> <!-- Prozedur --> +<short>Signalisierung: Header fertig eingelesen</short> +<descr> +<p>Diese Methode wird von abgeleiteten Klassen aufgerufen, sobald diese den +Header des Bildes fertig eingelesen und verarbeitet haben. Der Zustand des +Lesers wird auf <link id="TImageReaderState.irsHeaderFinished"/> gesetzt, und +die Behandlungsroutine des Ereignisses <link id="TImageReader.OnHeader"/> wird +aufgerufen, falls vorhanden.</p> +<p><var>HeaderFinished</var> darf nur von überschriebenen Methoden von +<link id="TImageReader.DoProcessHeaderData"/> aufgerufen werden; der Leser +befindet sich zu diesem Zeitpunkt noch im Zustand +<link id="TImageReaderState.irsInHeader"/>.</p> +</descr> +<errors> +Nur Debug-Version: Prüft per Zusicherung auf korrekten Zustand des Lesers. +</errors> +<seealso> + <link id="TImageReader.ProcessHeaderData"/> + <link id="TImageReader.DoProcessHeaderData"/> +</seealso> +</element> + +<element name="TImageReader.SegmentFinished"> <!-- Prozedur --> +<short>Signalisierung: Bildsegment eingelesen</short> +<descr> +<p>Abgeleitete Klassen rufen diese Methode auf, um zu signalisieren, daß ein +Segment des Bildes fertig eingelesen wurde. Falls vorhanden, wird die +Behandlungsroutine des Ereignisses <link id="TImageReader.OnSegment"/> +aufgerufen.</p> +<p><var>SegmentFinished</var> darf nur von überschriebenen Methoden von +<link id="TImageReader.DoProcessImageData"/> aufgerufen werden; der Leser +befindet sich zu diesem Zeitpunkt immer im Zustand +<link id="TImageReaderState.irsInImage"/>.</p> +</descr> +<errors> +Nur Debug-Version: Prüft per Zusicherung auf korrekten Zustand des Lesers. +</errors> +</element> + +<element name="TImageReader.SegmentFinished.AStartY"> <!-- Argument --> +<short>Y-Start-Koordinate des Segmentes</short> +</element> + +<element name="TImageReader.SegmentFinished.AHeight"> <!-- Argument --> +<short>Höhe des Segments in Pixel</short> +</element> + +<element name="TImageReader.ImageFinished"> <!-- Prozedur --> +<short>Signalisierung: Bild fertig eingelesen</short> +<descr> +<p>Eine abgeleitete Klasse ruft diese Methode auf, um anzuzeigen, daß das +gesamte Bild nun eingelesen wurde. Der Zustand des Lesers wird auf +<link id="TImageReaderState.irsFinished"/> gesetzt, und die Behandlungsroutine +für das Ereignis <link id="TImageReader.OnImage"/> wird aufgerufen, falls diese +gesetzt ist.</p> +<p><var>ImageFinished</var> darf nur von überschriebenen Methoden von +<link id="TImageReader.DoProcessImageData"/> aufgerufen werden; der Leser +befindet sich zu diesem Zeitpunkt noch im Zustand +<link id="TImageReaderState.irsInImage"/>.</p> +</descr> +<errors> +Nur Debug-Version: Prüft per Zusicherung auf korrekten Zustand des Lesers. +</errors> +</element> + +<element name="TImageReader.DoProcessHeaderData"> <!-- Prozedur --> +<short>Implementierung: Header-Daten verarbeiten</short> +<descr> +<p>Diese virtuelle Methode muß von abgeleiteten Klassen überschrieben werden, +um Header-Daten einlesen zu können.</p> +<p>Wenn diese Methode aufgerufen wird, steht mindestens ein Byte zum Lesen vom +angegebenen Stream-Objekt bereit - anderenfalls liegt ein Lesefehler vor. +Implementierungen dieser Methode sollten versuchen, soviel Bytes wie möglich +auf einmal zu verarbeiten; sie müssen aber nach einer beliebigen Anzahl von +gelesen Bytes ihre Arbeit unterbrechen können. Solange der aktuelle Zustand +<link id="TImageReaderState.irsInHeader"/> ist, wird der Aufrufer diese Methode +immer wieder aufrufen, wenn seiner Meinung nach neue Daten zur Verfügung +stehen. Achtung, diese Methode sollte nicht bereits in den Datenbereich +hineinlesen, da alle Bildleser nach Möglichkeit den Datenstrom rein von vorne +nach hinten verarbeiten können sollen, ohne zurückzuspringen.</p> +<p>Sobald der Header fertig eingelesen wurde und die Bildeigenschaften dieses +Objekts gesetzt wurden, muß <link id="TImageReader.HeaderFinished"/> aufgerufen +werden, und diese Methode verlassen werden.</p> +</descr> +<errors> +Kann nicht mindestens ein Byte vom Stream-Objekt gelesen werden, so muß eine +<link id="EImgOutOfData"/> Exception ausgelöst werden. +</errors> +<seealso> + <link id="TImageReader.ProcessHeaderData"/> +</seealso> +</element> + +<element name="TImageReader.DoProcessHeaderData.AStream"> <!-- Argument --> +<short>Quelle für die Header-Daten</short> +</element> + +<element name="TImageReader.DoGetImageSegmentStartY"> <!-- Funktion --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.DoGetImageSegmentStartY.Result"> <!-- Funktionsergebnis --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.DoGetImageSegmentStartY.ASegmentHeight"> <!-- Argument --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.InitImageReading"> <!-- Prozedur --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.DoProcessImageData"> <!-- Prozedur --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.DoProcessImageData.AStream"> <!-- Argument --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.Create"> <!-- Konstruktur --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.ProcessHeaderData"> <!-- Prozedur --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.ProcessHeaderData.AStream"> <!-- Argument --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.GetImageSegmentStartY"> <!-- Funktion --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.GetImageSegmentStartY.Result"> <!-- Funktionsergebnis --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.GetImageSegmentStartY.ASegmentHeight"> <!-- Argument --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.SetImageSegmentBuffer"> <!-- Prozedur --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.SetImageSegmentBuffer.AData"> <!-- Argument --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.SetImageSegmentBuffer.AStride"> <!-- Argument --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.SetImageSegmentBuffer.ASegmentHeight"> <!-- Argument --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.ProcessImageData"> <!-- Prozedur --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.ProcessImageData.AStream"> <!-- Argument --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.State"> <!-- Eigenschaft --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.Width"> <!-- Eigenschaft --> +<short>Breite des Bildes</short> +<descr> +Diese Eigenschaft gibt die Breite des Bildes in Pixeln an. Sie wird im Rahmen +des Header-Einlesens gesetzt und besitzt ab dem Zustand +<link id="TImageReaderState.irsHeaderFinished"/> einen gültigen (und +endgültigen) Wert. +</descr> +<seealso> + <link id="TImageReader.FWidth"/> +</seealso> +</element> + +<element name="TImageReader.Height"> <!-- Eigenschaft --> +<short>Höhe des Bildes</short> +<descr> +Diese Eigenschaft gibt die Höhe des Bildes in Pixeln an. Sie wird im Rahmen +des Header-Einlesens gesetzt und besitzt ab dem Zustand +<link id="TImageReaderState.irsHeaderFinished"/> einen gültigen (und +endgültigen) Wert. +</descr> +<seealso> + <link id="TImageReader.FHeight"/> +</seealso> +</element> + +<element name="TImageReader.PixelFormat"> <!-- Eigenschaft --> +<short>Pixelformat des Bildes</short> +<descr> +Diese Eigenschaft beschreibt das Pixelformat, in welchem die Pixeldaten +vorliegen. Sie wird im Rahmen des Header-Einlesens gesetzt und besitzt ab dem +Zustand <link id="TImageReaderState.irsHeaderFinished"/> einen gültigen (und +endgültigen) Wert. +</descr> +<seealso> + <link id="GFXBase.TGfxPixelFormat"/> + <link id="TImageReader.FPixelFormat"/> +</seealso> +</element> + +<element name="TImageReader.SegmentData"> <!-- Eigenschaft --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.SegmentStride"> <!-- Eigenschaft --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.SegmentHeight"> <!-- Eigenschaft --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.SegmentSize"> <!-- Eigenschaft --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.OnHeader"> <!-- Eigenschaft --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.OnSegment"> <!-- Eigenschaft --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> + +<element name="TImageReader.OnImage"> <!-- Eigenschaft --> +<short></short> +<descr> +</descr> +<errors> +</errors> +<seealso> +</seealso> +</element> +</module> <!-- ImageIO --> +</fpdoc-descriptions> diff --git a/examples/gfx/eventtest/Makefile b/examples/gfx/eventtest/Makefile new file mode 100644 index 00000000..949a74c3 --- /dev/null +++ b/examples/gfx/eventtest/Makefile @@ -0,0 +1,1235 @@ +# +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/11/22] +# +default: all +override PATH:=$(subst \,/,$(PATH)) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif +endif +ifdef inUnix +BATCHEXT=.sh +else +ifdef inOS2 +BATCHEXT=.cmd +else +BATCHEXT=.bat +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +FPC:=$(shell $(FPCPROG) -PB) +ifneq ($(findstring Error,$(FPC)),) +override FPC=ppc386 +endif +else +override FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif +export FPC FPC_VERSION +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif +FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(FULL_TARGET),$(FULL_SOURCE)) +CROSSCOMPILE=1 +endif +export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE CROSSCOMPILE +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +ifndef CROSSDIR +CROSSDIR:=$(FPCDIR)/cross/$(FULL_TARGET) +endif +ifndef CROSSTARGETDIR +CROSSTARGETDIR=$(CROSSDIR)/$(FULL_TARGET) +endif +ifdef CROSSCOMPILE +UNITSDIR:=$(wildcard $(CROSSTARGETDIR)/units) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +else +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override TARGET_PROGRAMS+=eventtest +override COMPILER_OPTIONS+=-S2h +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),netbsd) +UNIXINSTALLDIR=1 +endif +else +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),netbsd) +UNIXINSTALLDIR=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXINSTALLDIR +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXINSTALLDIR +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) +endif +endif +endif +ifndef INSTALL_UNITDIR +ifdef CROSSCOMPILE +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/units +else +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +endif +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXINSTALLDIR +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(FULL_SOURCE)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifdef inUnix +ifndef GCCLIBDIR +GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`) +endif +ifeq ($(OS_TARGET),linux) +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifeq ($(OS_TARGET),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +STATICLIBPREFIX=libp +RSTEXT=.rst +FPCMADE=fpcmade +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 +endif +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux +endif +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd +endif +ifeq ($(OS_TARGET),netbsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.netbsd +ZIPSUFFIX=netbsd +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata +endif +ifeq ($(OS_TARGET),beos) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +FPCMADE=fpcmade.be +ZIPSUFFIX=be +endif +ifeq ($(OS_TARGET),sunos) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +FPCMADE=fpcmade.sun +ZIPSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +FPCMADE=fpcmade.qnx +ZIPSUFFIX=qnx +endif +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -rfp +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=as +LDNAME=ld +ARNAME=ar +RCNAME=rc +ifeq ($(OS_TARGET),win32) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(BATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +ifeq ($(OS_TARGET),linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_FPGFX=1 +REQUIRE_PACKAGES_FPGFX_X11=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_RTL),) +PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL)) +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +endif +else +PACKAGEDIR_RTL= +UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_RTL),) +UNITDIR_RTL:=$(firstword $(UNITDIR_RTL)) +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override COMPILER_UNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef REQUIRE_PACKAGES_PASZLIB +PACKAGEDIR_PASZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +PACKAGEDIR_PASZLIB:=$(firstword $(PACKAGEDIR_PASZLIB)) +ifeq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_paszlib +package_paszlib: + $(MAKE) -C $(PACKAGEDIR_PASZLIB) all +endif +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_INET +PACKAGEDIR_INET:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_INET),) +PACKAGEDIR_INET:=$(firstword $(PACKAGEDIR_INET)) +ifeq ($(wildcard $(PACKAGEDIR_INET)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_inet +package_inet: + $(MAKE) -C $(PACKAGEDIR_INET) all +endif +ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),) +UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET) +else +UNITDIR_INET=$(PACKAGEDIR_INET) +endif +else +PACKAGEDIR_INET= +UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_INET),) +UNITDIR_INET:=$(firstword $(UNITDIR_INET)) +else +UNITDIR_INET= +endif +endif +ifdef UNITDIR_INET +override COMPILER_UNITDIR+=$(UNITDIR_INET) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_MYSQL),) +PACKAGEDIR_MYSQL:=$(firstword $(PACKAGEDIR_MYSQL)) +ifeq ($(wildcard $(PACKAGEDIR_MYSQL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_mysql +package_mysql: + $(MAKE) -C $(PACKAGEDIR_MYSQL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_IBASE),) +PACKAGEDIR_IBASE:=$(firstword $(PACKAGEDIR_IBASE)) +ifeq ($(wildcard $(PACKAGEDIR_IBASE)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_ibase +package_ibase: + $(MAKE) -C $(PACKAGEDIR_IBASE) all +endif +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FCL),) +PACKAGEDIR_FCL:=$(firstword $(PACKAGEDIR_FCL)) +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_FPGFX +PACKAGEDIR_FPGFX:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpgfx/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FPGFX),) +PACKAGEDIR_FPGFX:=$(firstword $(PACKAGEDIR_FPGFX)) +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FPGFX)/$(OS_TARGET)),) +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX)/$(OS_TARGET) +else +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +endif +else +PACKAGEDIR_FPGFX= +UNITDIR_FPGFX:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpgfx/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FPGFX),) +UNITDIR_FPGFX:=$(firstword $(UNITDIR_FPGFX)) +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override COMPILER_UNITDIR+=$(UNITDIR_FPGFX) +endif +endif +ifdef REQUIRE_PACKAGES_FPGFX_X11 +PACKAGEDIR_FPGFX_X11:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpgfx_x11/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FPGFX_X11),) +PACKAGEDIR_FPGFX_X11:=$(firstword $(PACKAGEDIR_FPGFX_X11)) +ifeq ($(wildcard $(PACKAGEDIR_FPGFX_X11)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx_x11 +package_fpgfx_x11: + $(MAKE) -C $(PACKAGEDIR_FPGFX_X11) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FPGFX_X11)/$(OS_TARGET)),) +UNITDIR_FPGFX_X11=$(PACKAGEDIR_FPGFX_X11)/$(OS_TARGET) +else +UNITDIR_FPGFX_X11=$(PACKAGEDIR_FPGFX_X11) +endif +else +PACKAGEDIR_FPGFX_X11= +UNITDIR_FPGFX_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpgfx_x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FPGFX_X11),) +UNITDIR_FPGFX_X11:=$(firstword $(UNITDIR_FPGFX_X11)) +else +UNITDIR_FPGFX_X11= +endif +endif +ifdef UNITDIR_FPGFX_X11 +override COMPILER_UNITDIR+=$(UNITDIR_FPGFX_X11) +endif +endif +.PHONY: package_rtl package_paszlib package_inet package_mysql package_ibase package_fcl package_fpgfx package_fpgfx_x11 +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +else +FPCCPUOPT:= +endif +override FPCOPT+=-Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-OG2p3 +endif +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif +.PHONY: fpc_exes +ifdef TARGET_PROGRAMS +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +fpc_exes: $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_packages fpc_all fpc_smart fpc_debug +$(FPCMADE): $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_packages: $(COMPILEPACKAGES) +fpc_all: fpc_packages $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))) +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(ECHO) Target OS.... $(OS_TARGET) + @$(ECHO) Full Target.. $(FULL_SOURCE) + @$(ECHO) Full Source.. $(FULL_TARGET) + @$(ECHO) + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) + @$(ECHO) DateStr.............. $(DATESTR) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) + @$(ECHO) + @$(ECHO) Install base dir..... $(INSTALL_BASEDIR) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +all: fpc_all +debug: fpc_debug +smart: fpc_smart +examples: +shared: +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +.PHONY: all debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif diff --git a/examples/gfx/eventtest/Makefile.fpc b/examples/gfx/eventtest/Makefile.fpc new file mode 100644 index 00000000..574695c5 --- /dev/null +++ b/examples/gfx/eventtest/Makefile.fpc @@ -0,0 +1,15 @@ +# +# Makefile.fpc for fpGFX example "EventTest" +# + +[target] +programs=eventtest + +[require] +packages=fcl fpgfx +packages_linux=fpgfx_x11 +packages_freebsd=fpgfx_x11 +packages_netbsd=fpgfx_x11 + +[compiler] +options=-S2h diff --git a/examples/gfx/eventtest/eventtest.lpi b/examples/gfx/eventtest/eventtest.lpi new file mode 100644 index 00000000..f1db74ad --- /dev/null +++ b/examples/gfx/eventtest/eventtest.lpi @@ -0,0 +1,50 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="\"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + </General> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpgfxpackage"/> + <MaxVersion Minor="2" Release="1"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="eventtest.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="EventTest"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <PathDelim Value="\"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/gfx/eventtest/eventtest.pas b/examples/gfx/eventtest/eventtest.pas new file mode 100644 index 00000000..d870773d --- /dev/null +++ b/examples/gfx/eventtest/eventtest.pas @@ -0,0 +1,251 @@ +{ + fpGUI - Free Pascal GUI Library + + Event Test example + + Copyright (C) 2000 - 2006 See the file AUTHORS, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + 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. +} + +program EventTest; + +uses + SysUtils, + Classes, + GFXBase, + fpGFX; + + +const + ButtonNames: array[TMouseButton] of PChar = + ('Left', 'Right', 'Middle'); + +type + TMainWindow = class(TFWindow) + procedure FocusIn(Sender: TObject); + procedure FocusOut(Sender: TObject); + procedure KeyPressed(Sender: TObject; AKey: Word; AShiftState: TShiftState); + procedure KeyReleased(Sender: TObject; AKey: Word; AShiftState: TShiftState); + procedure KeyChar(Sender: TObject; AKeyChar: Char); + procedure MouseEnter(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint); + procedure MouseLeave(Sender: TObject); + procedure MousePressed(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure MouseReleased(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure MouseMove(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint); + procedure MouseWheel(Sender: TObject; AShift: TShiftState; AWheelDelta: Single; const AMousePos: TPoint); + procedure Paint(Sender: TObject; const ARect: TRect); + procedure Move(Sender: TObject); + procedure Resize(Sender: TObject); + private + function ShiftStateToStr(Shift: TShiftState): String; + function MouseState(AShift: TShiftState; const AMousePos: TPoint): String; + public + constructor Create; + end; + + +constructor TMainWindow.Create; +begin + inherited Create(nil, [woWindow]); + + Title := 'fpGFX Event Test example'; + SetClientSize(Size(500, 100)); + + OnFocusIn := @FocusIn; + OnFocusOut := @FocusOut; + OnKeyPressed := @KeyPressed; + OnKeyReleased := @KeyReleased; + OnKeyChar := @KeyChar; + OnMouseEnter := @MouseEnter; + OnMouseLeave := @MouseLeave; + OnMousePressed := @MousePressed; + OnMouseReleased := @MouseReleased; + OnMouseMove := @MouseMove; + OnMouseWheel := @MouseWheel; + OnPaint := @Paint; + OnMove := @Move; + OnResize := @Resize; + Show; +end; + + +function TMainWindow.ShiftStateToStr(Shift: TShiftState): String; +begin + SetLength(Result, 0); + if ssShift in Shift then + Result := 'Shift '; + if ssAlt in Shift then + Result := Result + 'Alt '; + if ssCtrl in Shift then + Result := Result + 'Ctrl '; + if ssMeta in Shift then + Result := Result + 'Meta '; + if ssSuper in Shift then + Result := Result + 'Super '; + if ssHyper in Shift then + Result := Result + 'Hyper '; + if ssAltGr in Shift then + Result := Result + 'AltGr '; + if ssCaps in Shift then + Result := Result + 'Caps '; + if ssNum in Shift then + Result := Result + 'Num '; + if ssScroll in Shift then + Result := Result + 'Scroll '; + if ssLeft in Shift then + Result := Result + 'Left '; + if ssRight in Shift then + Result := Result + 'Right '; + if ssMiddle in Shift then + Result := Result + 'Middle '; + if ssDouble in Shift then + Result := Result + 'Double '; + if Length(Result) > 0 then + SetLength(Result, Length(Result) - 1); +end; + + +function TMainWindow.MouseState(AShift: TShiftState; + const AMousePos: TPoint): String; +var + ShiftStateStr: String; +begin + ShiftStateStr := ShiftStateToStr(AShift); + Result := '[X=' + IntToStr(AMousePos.x) + ' Y=' + IntToStr(AMousePos.y); + if Length(ShiftStateStr) > 0 then + Result := Result + ' ' + ShiftStateStr; + Result := Result + ']'; +end; + + +procedure TMainWindow.FocusIn(Sender: TObject); +begin + WriteLn('Got focus'); +end; + + +procedure TMainWindow.FocusOut(Sender: TObject); +begin + WriteLn('Lost focus'); +end; + + +procedure TMainWindow.KeyPressed(Sender: TObject; AKey: Word; + AShiftState: TShiftState); +begin + WriteLn('[', ShiftStateToStr(AShiftState), '] Key pressed: ', + KeycodeToText(AKey, [])); +end; + + +procedure TMainWindow.KeyReleased(Sender: TObject; AKey: Word; + AShiftState: TShiftState); +begin + WriteLn('[', ShiftStateToStr(AShiftState), '] Key released: ', + KeycodeToText(AKey, [])); +end; + + +procedure TMainWindow.KeyChar(Sender: TObject; AKeyChar: Char); +begin + Write('Character generated: '); + if AKeyChar >= ' ' then + WriteLn('''', AKeyChar, '''') + else + WriteLn('#', Ord(AKeyChar)); +end; + + +procedure TMainWindow.MouseEnter(Sender: TObject; AShift: TShiftState; + const AMousePos: TPoint); +begin + WriteLn(MouseState(AShift, AMousePos), 'Mouse entered window'); +end; + + +procedure TMainWindow.MouseLeave(Sender: TObject); +begin + WriteLn('Mouse left window'); +end; + + +procedure TMainWindow.MousePressed(Sender: TObject; AButton: TMouseButton; + AShift: TShiftState; const AMousePos: TPoint); +begin + WriteLn(MouseState(AShift, AMousePos), + 'Mouse button pressed: ', ButtonNames[AButton]); +end; + + +procedure TMainWindow.MouseReleased(Sender: TObject; AButton: TMouseButton; + AShift: TShiftState; const AMousePos: TPoint); +begin + WriteLn(MouseState(AShift, AMousePos), + 'Mouse button released: ', ButtonNames[AButton]); +end; + + +procedure TMainWindow.MouseMove(Sender: TObject; AShift: TShiftState; + const AMousePos: TPoint); +begin + WriteLn(MouseState(AShift, AMousePos), 'Mouse moved'); +end; + + +procedure TMainWindow.MouseWheel(Sender: TObject; AShift: TShiftState; + AWheelDelta: Single; const AMousePos: TPoint); +begin + WriteLn(MouseState(AShift, AMousePos), 'Mouse wheel rotated by ', + AWheelDelta:0:2, ' ticks'); +end; + + +procedure TMainWindow.Paint(Sender: TObject; const ARect: TRect); +begin + with Canvas do + begin + SetColor(colWhite); + FillRect(ARect); + SetColor(colBlack); + TextOut(Point(0, 0), 'Event test'); + TextOut(Point(0, FontCellHeight), + 'Do something interactive (move mouse, press keys...)'); + TextOut(Point(0, FontCellHeight * 2), + 'and watch the output on the console.'); + end; +end; + + +procedure TMainWindow.Move(Sender: TObject); +begin + WriteLn('Window has been moved to ', Left, '/', Top); +end; + + +procedure TMainWindow.Resize(Sender: TObject); +begin + WriteLn('Window has been resized. New width: ', + Width, ' x ', Height, + '; new client width: ', ClientWidth, ' x ', ClientHeight); +end; + + +var + MainWindow: TMainWindow; + +begin + gApplication.Initialize; + MainWindow := TMainWindow.Create; + gApplication.AddWindow(MainWindow); + MainWindow.Show; + gApplication.Run; +end. + + diff --git a/examples/gfx/helloworld/Makefile b/examples/gfx/helloworld/Makefile new file mode 100644 index 00000000..8afc2bbb --- /dev/null +++ b/examples/gfx/helloworld/Makefile @@ -0,0 +1,1235 @@ +# +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/11/22] +# +default: all +override PATH:=$(subst \,/,$(PATH)) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif +endif +ifdef inUnix +BATCHEXT=.sh +else +ifdef inOS2 +BATCHEXT=.cmd +else +BATCHEXT=.bat +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +FPC:=$(shell $(FPCPROG) -PB) +ifneq ($(findstring Error,$(FPC)),) +override FPC=ppc386 +endif +else +override FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif +export FPC FPC_VERSION +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif +FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(FULL_TARGET),$(FULL_SOURCE)) +CROSSCOMPILE=1 +endif +export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE CROSSCOMPILE +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +ifndef CROSSDIR +CROSSDIR:=$(FPCDIR)/cross/$(FULL_TARGET) +endif +ifndef CROSSTARGETDIR +CROSSTARGETDIR=$(CROSSDIR)/$(FULL_TARGET) +endif +ifdef CROSSCOMPILE +UNITSDIR:=$(wildcard $(CROSSTARGETDIR)/units) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +else +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override TARGET_PROGRAMS+=helloworld +override COMPILER_OPTIONS+=-S2h +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),netbsd) +UNIXINSTALLDIR=1 +endif +else +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),netbsd) +UNIXINSTALLDIR=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXINSTALLDIR +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXINSTALLDIR +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) +endif +endif +endif +ifndef INSTALL_UNITDIR +ifdef CROSSCOMPILE +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/units +else +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +endif +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXINSTALLDIR +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(FULL_SOURCE)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifdef inUnix +ifndef GCCLIBDIR +GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`) +endif +ifeq ($(OS_TARGET),linux) +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifeq ($(OS_TARGET),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +STATICLIBPREFIX=libp +RSTEXT=.rst +FPCMADE=fpcmade +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 +endif +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux +endif +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd +endif +ifeq ($(OS_TARGET),netbsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.netbsd +ZIPSUFFIX=netbsd +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata +endif +ifeq ($(OS_TARGET),beos) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +FPCMADE=fpcmade.be +ZIPSUFFIX=be +endif +ifeq ($(OS_TARGET),sunos) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +FPCMADE=fpcmade.sun +ZIPSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +FPCMADE=fpcmade.qnx +ZIPSUFFIX=qnx +endif +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -rfp +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=as +LDNAME=ld +ARNAME=ar +RCNAME=rc +ifeq ($(OS_TARGET),win32) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(BATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +ifeq ($(OS_TARGET),linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_FPGFX=1 +REQUIRE_PACKAGES_FPGFX_X11=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_RTL),) +PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL)) +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +endif +else +PACKAGEDIR_RTL= +UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_RTL),) +UNITDIR_RTL:=$(firstword $(UNITDIR_RTL)) +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override COMPILER_UNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef REQUIRE_PACKAGES_PASZLIB +PACKAGEDIR_PASZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +PACKAGEDIR_PASZLIB:=$(firstword $(PACKAGEDIR_PASZLIB)) +ifeq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_paszlib +package_paszlib: + $(MAKE) -C $(PACKAGEDIR_PASZLIB) all +endif +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_INET +PACKAGEDIR_INET:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_INET),) +PACKAGEDIR_INET:=$(firstword $(PACKAGEDIR_INET)) +ifeq ($(wildcard $(PACKAGEDIR_INET)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_inet +package_inet: + $(MAKE) -C $(PACKAGEDIR_INET) all +endif +ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),) +UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET) +else +UNITDIR_INET=$(PACKAGEDIR_INET) +endif +else +PACKAGEDIR_INET= +UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_INET),) +UNITDIR_INET:=$(firstword $(UNITDIR_INET)) +else +UNITDIR_INET= +endif +endif +ifdef UNITDIR_INET +override COMPILER_UNITDIR+=$(UNITDIR_INET) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_MYSQL),) +PACKAGEDIR_MYSQL:=$(firstword $(PACKAGEDIR_MYSQL)) +ifeq ($(wildcard $(PACKAGEDIR_MYSQL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_mysql +package_mysql: + $(MAKE) -C $(PACKAGEDIR_MYSQL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_IBASE),) +PACKAGEDIR_IBASE:=$(firstword $(PACKAGEDIR_IBASE)) +ifeq ($(wildcard $(PACKAGEDIR_IBASE)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_ibase +package_ibase: + $(MAKE) -C $(PACKAGEDIR_IBASE) all +endif +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FCL),) +PACKAGEDIR_FCL:=$(firstword $(PACKAGEDIR_FCL)) +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_FPGFX +PACKAGEDIR_FPGFX:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpgfx/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FPGFX),) +PACKAGEDIR_FPGFX:=$(firstword $(PACKAGEDIR_FPGFX)) +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FPGFX)/$(OS_TARGET)),) +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX)/$(OS_TARGET) +else +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +endif +else +PACKAGEDIR_FPGFX= +UNITDIR_FPGFX:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpgfx/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FPGFX),) +UNITDIR_FPGFX:=$(firstword $(UNITDIR_FPGFX)) +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override COMPILER_UNITDIR+=$(UNITDIR_FPGFX) +endif +endif +ifdef REQUIRE_PACKAGES_FPGFX_X11 +PACKAGEDIR_FPGFX_X11:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpgfx_x11/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FPGFX_X11),) +PACKAGEDIR_FPGFX_X11:=$(firstword $(PACKAGEDIR_FPGFX_X11)) +ifeq ($(wildcard $(PACKAGEDIR_FPGFX_X11)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx_x11 +package_fpgfx_x11: + $(MAKE) -C $(PACKAGEDIR_FPGFX_X11) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FPGFX_X11)/$(OS_TARGET)),) +UNITDIR_FPGFX_X11=$(PACKAGEDIR_FPGFX_X11)/$(OS_TARGET) +else +UNITDIR_FPGFX_X11=$(PACKAGEDIR_FPGFX_X11) +endif +else +PACKAGEDIR_FPGFX_X11= +UNITDIR_FPGFX_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpgfx_x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FPGFX_X11),) +UNITDIR_FPGFX_X11:=$(firstword $(UNITDIR_FPGFX_X11)) +else +UNITDIR_FPGFX_X11= +endif +endif +ifdef UNITDIR_FPGFX_X11 +override COMPILER_UNITDIR+=$(UNITDIR_FPGFX_X11) +endif +endif +.PHONY: package_rtl package_paszlib package_inet package_mysql package_ibase package_fcl package_fpgfx package_fpgfx_x11 +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +else +FPCCPUOPT:= +endif +override FPCOPT+=-Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-OG2p3 +endif +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif +.PHONY: fpc_exes +ifdef TARGET_PROGRAMS +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +fpc_exes: $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_packages fpc_all fpc_smart fpc_debug +$(FPCMADE): $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_packages: $(COMPILEPACKAGES) +fpc_all: fpc_packages $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))) +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(ECHO) Target OS.... $(OS_TARGET) + @$(ECHO) Full Target.. $(FULL_SOURCE) + @$(ECHO) Full Source.. $(FULL_TARGET) + @$(ECHO) + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) + @$(ECHO) DateStr.............. $(DATESTR) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) + @$(ECHO) + @$(ECHO) Install base dir..... $(INSTALL_BASEDIR) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +all: fpc_all +debug: fpc_debug +smart: fpc_smart +examples: +shared: +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +.PHONY: all debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif diff --git a/examples/gfx/helloworld/Makefile.fpc b/examples/gfx/helloworld/Makefile.fpc new file mode 100644 index 00000000..093a2c01 --- /dev/null +++ b/examples/gfx/helloworld/Makefile.fpc @@ -0,0 +1,15 @@ +# +# Makefile.fpc for fpGFX example "HelloWorld" +# + +[target] +programs=helloworld + +[require] +packages=fcl fpgfx +packages_linux=fpgfx_x11 +packages_freebsd=fpgfx_x11 +packages_netbsd=fpgfx_x11 + +[compiler] +options=-S2h diff --git a/examples/gfx/helloworld/helloworld.lpi b/examples/gfx/helloworld/helloworld.lpi new file mode 100644 index 00000000..ba59cdff --- /dev/null +++ b/examples/gfx/helloworld/helloworld.lpi @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="\"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + </General> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpgfxpackage"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="helloworld.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="HelloWorld"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <PathDelim Value="\"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value=" +"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/gfx/helloworld/helloworld.pas b/examples/gfx/helloworld/helloworld.pas new file mode 100644 index 00000000..fa7d93ce --- /dev/null +++ b/examples/gfx/helloworld/helloworld.pas @@ -0,0 +1,104 @@ +{ + fpGUI - Free Pascal GUI Library + + HelloWorld - GFX Hello World application + + Copyright (C) 2000 - 2006 See the file AUTHORS, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + 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. +} +program HelloWorld; + +uses + Classes, + Types, + fpGFX, + GFXBase + ; + +const + HelloWorldString: String = 'Hello, world!'; + +type + + { TMainWindow } + + TMainWindow = class(TFWindow) + public + Font: TFCustomFont; + TextSize: TSize; + procedure Paint(Sender: TObject; const Rect: TRect); + constructor Create; + end; + +procedure TMainWindow.Paint(Sender: TObject; const Rect: TRect); +var + Color: TGfxColor; + r: TRect; + i: Integer; +begin + Color.Red := 0; + Color.Green := 0; + Color.Alpha := 0; + r.Left := Rect.Left; + r.Right := Rect.Right; + for i := Rect.Top to Rect.Bottom - 1 do + begin + Color.Blue := $ffff - (i * $ffff) div ClientHeight; + Canvas.SetColor(Color); + r.Top := i; + r.Bottom := i + 1; + Canvas.FillRect(r); + end; + + Canvas.SetColor(colBlack); + Canvas.SetFont(Font); + Canvas.TextOut(Point((ClientWidth - TextSize.cx) div 2 + 1, + (ClientHeight - TextSize.cy) div 2 + 1), HelloWorldString); + + Canvas.SetColor(colWhite); + Canvas.TextOut(Point((ClientWidth - TextSize.cx) div 2 - 1, + (ClientHeight - TextSize.cy) div 2 - 1), HelloWorldString); +end; + +constructor TMainWindow.Create; +begin + inherited Create(nil, [woWindow]); + + { Possible font classes: + fcSerif, fcSansSerif, fcTypewriter, fcDingbats } + Font := TFFont.Create('-*-' + + TFFont.GetDefaultFontName(fcSerif) + + '-*-r-*-*-34-*-*-*-*-*-*-*'); + + Title := 'fpGFX Hello World example'; + OnPaint := @Paint; + Canvas.SetFont(Font); + TextSize.cx := Canvas.TextWidth(HelloWorldString); + TextSize.cy := Canvas.FontCellHeight; + SetClientSize(Size((TextSize.cx * 3) div 2, TextSize.cy * 2)); + SetMinMaxClientSize(TextSize, Size(0, 0)); +end; + + +var + MainWindow: TMainWindow; +begin + gApplication.Initialize; + + MainWindow := TMainWindow.Create; + + gApplication.AddWindow(MainWindow); + + MainWindow.Show; + + gApplication.Run; +end. + + diff --git a/examples/gfx/imgtest/Makefile b/examples/gfx/imgtest/Makefile new file mode 100644 index 00000000..80c9b82e --- /dev/null +++ b/examples/gfx/imgtest/Makefile @@ -0,0 +1,1235 @@ +# +# Don't edit, this file is generated by FPCMake Version 1.1 [2001/11/22] +# +default: all +override PATH:=$(subst \,/,$(PATH)) +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygwin,$(MACHTYPE)),) +inCygWin=1 +endif +endif +ifdef inUnix +BATCHEXT=.sh +else +ifdef inOS2 +BATCHEXT=.cmd +else +BATCHEXT=.bat +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +FPC:=$(shell $(FPCPROG) -PB) +ifneq ($(findstring Error,$(FPC)),) +override FPC=ppc386 +endif +else +override FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif +export FPC FPC_VERSION +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif +FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(FULL_TARGET),$(FULL_SOURCE)) +CROSSCOMPILE=1 +endif +export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE CROSSCOMPILE +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +ifndef CROSSDIR +CROSSDIR:=$(FPCDIR)/cross/$(FULL_TARGET) +endif +ifndef CROSSTARGETDIR +CROSSTARGETDIR=$(CROSSDIR)/$(FULL_TARGET) +endif +ifdef CROSSCOMPILE +UNITSDIR:=$(wildcard $(CROSSTARGETDIR)/units) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +else +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages) +override TARGET_PROGRAMS+=imgtest +override COMPILER_OPTIONS+=-S2h +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),netbsd) +UNIXINSTALLDIR=1 +endif +else +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),netbsd) +UNIXINSTALLDIR=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXINSTALLDIR +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef INSTALL_BASEDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXINSTALLDIR +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(OS_TARGET) +endif +endif +endif +ifndef INSTALL_UNITDIR +ifdef CROSSCOMPILE +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/units +else +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(OS_TARGET) +endif +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXINSTALLDIR +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/src/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIRL:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXINSTALLDIR +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(FULL_SOURCE)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(FULL_TARGET)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifdef inUnix +ifndef GCCLIBDIR +GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`) +endif +ifeq ($(OS_TARGET),linux) +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifeq ($(OS_TARGET),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +STATICLIBPREFIX=libp +RSTEXT=.rst +FPCMADE=fpcmade +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +FPCMADE=fpcmade.v1 +PACKAGESUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +FPCMADE=fpcmade.dos +ZIPSUFFIX=go32 +endif +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +ZIPSUFFIX=linux +endif +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +ZIPSUFFIX=freebsd +endif +ifeq ($(OS_TARGET),netbsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.netbsd +ZIPSUFFIX=netbsd +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +ZIPSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +ZIPSUFFIX=emx +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppa +ASMEXT=.asm +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +FPCMADE=fpcmade.amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppt +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +FPCMADE=fpcmade.ata +endif +ifeq ($(OS_TARGET),beos) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +FPCMADE=fpcmade.be +ZIPSUFFIX=be +endif +ifeq ($(OS_TARGET),sunos) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +FPCMADE=fpcmade.sun +ZIPSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +FPCMADE=fpcmade.qnx +ZIPSUFFIX=qnx +endif +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef ECHOREDIR +ECHOREDIR:=$(subst /,$(PATHSEP),$(ECHO)) +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -rfp +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=as +LDNAME=ld +ARNAME=ar +RCNAME=rc +ifeq ($(OS_TARGET),win32) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(BATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +ifeq ($(OS_TARGET),linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_INET=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_FPGFX=1 +REQUIRE_PACKAGES_FPGFX_X11=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_RTL),) +PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL)) +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +endif +else +PACKAGEDIR_RTL= +UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_RTL),) +UNITDIR_RTL:=$(firstword $(UNITDIR_RTL)) +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override COMPILER_UNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef REQUIRE_PACKAGES_PASZLIB +PACKAGEDIR_PASZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +PACKAGEDIR_PASZLIB:=$(firstword $(PACKAGEDIR_PASZLIB)) +ifeq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_paszlib +package_paszlib: + $(MAKE) -C $(PACKAGEDIR_PASZLIB) all +endif +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/$(OS_TARGET)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/$(OS_TARGET) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_INET +PACKAGEDIR_INET:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /inet/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_INET),) +PACKAGEDIR_INET:=$(firstword $(PACKAGEDIR_INET)) +ifeq ($(wildcard $(PACKAGEDIR_INET)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_inet +package_inet: + $(MAKE) -C $(PACKAGEDIR_INET) all +endif +ifneq ($(wildcard $(PACKAGEDIR_INET)/$(OS_TARGET)),) +UNITDIR_INET=$(PACKAGEDIR_INET)/$(OS_TARGET) +else +UNITDIR_INET=$(PACKAGEDIR_INET) +endif +else +PACKAGEDIR_INET= +UNITDIR_INET:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /inet/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_INET),) +UNITDIR_INET:=$(firstword $(UNITDIR_INET)) +else +UNITDIR_INET= +endif +endif +ifdef UNITDIR_INET +override COMPILER_UNITDIR+=$(UNITDIR_INET) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_MYSQL),) +PACKAGEDIR_MYSQL:=$(firstword $(PACKAGEDIR_MYSQL)) +ifeq ($(wildcard $(PACKAGEDIR_MYSQL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_mysql +package_mysql: + $(MAKE) -C $(PACKAGEDIR_MYSQL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/$(OS_TARGET)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/$(OS_TARGET) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_IBASE),) +PACKAGEDIR_IBASE:=$(firstword $(PACKAGEDIR_IBASE)) +ifeq ($(wildcard $(PACKAGEDIR_IBASE)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_ibase +package_ibase: + $(MAKE) -C $(PACKAGEDIR_IBASE) all +endif +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/$(OS_TARGET)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/$(OS_TARGET) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FCL),) +PACKAGEDIR_FCL:=$(firstword $(PACKAGEDIR_FCL)) +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FCL)/$(OS_TARGET)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/$(OS_TARGET) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_FPGFX +PACKAGEDIR_FPGFX:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpgfx/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FPGFX),) +PACKAGEDIR_FPGFX:=$(firstword $(PACKAGEDIR_FPGFX)) +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FPGFX)/$(OS_TARGET)),) +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX)/$(OS_TARGET) +else +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +endif +else +PACKAGEDIR_FPGFX= +UNITDIR_FPGFX:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpgfx/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FPGFX),) +UNITDIR_FPGFX:=$(firstword $(UNITDIR_FPGFX)) +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override COMPILER_UNITDIR+=$(UNITDIR_FPGFX) +endif +endif +ifdef REQUIRE_PACKAGES_FPGFX_X11 +PACKAGEDIR_FPGFX_X11:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpgfx_x11/Makefile.fpc,$(PACKAGESDIR))))) +ifneq ($(PACKAGEDIR_FPGFX_X11),) +PACKAGEDIR_FPGFX_X11:=$(firstword $(PACKAGEDIR_FPGFX_X11)) +ifeq ($(wildcard $(PACKAGEDIR_FPGFX_X11)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx_x11 +package_fpgfx_x11: + $(MAKE) -C $(PACKAGEDIR_FPGFX_X11) all +endif +ifneq ($(wildcard $(PACKAGEDIR_FPGFX_X11)/$(OS_TARGET)),) +UNITDIR_FPGFX_X11=$(PACKAGEDIR_FPGFX_X11)/$(OS_TARGET) +else +UNITDIR_FPGFX_X11=$(PACKAGEDIR_FPGFX_X11) +endif +else +PACKAGEDIR_FPGFX_X11= +UNITDIR_FPGFX_X11:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpgfx_x11/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FPGFX_X11),) +UNITDIR_FPGFX_X11:=$(firstword $(UNITDIR_FPGFX_X11)) +else +UNITDIR_FPGFX_X11= +endif +endif +ifdef UNITDIR_FPGFX_X11 +override COMPILER_UNITDIR+=$(UNITDIR_FPGFX_X11) +endif +endif +.PHONY: package_rtl package_paszlib package_inet package_mysql package_ibase package_fcl package_fpgfx package_fpgfx_x11 +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +else +FPCCPUOPT:= +endif +override FPCOPT+=-Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-OG2p3 +endif +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif +.PHONY: fpc_exes +ifdef TARGET_PROGRAMS +override EXEFILES=$(addsuffix $(EXEEXT),$(TARGET_PROGRAMS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(TARGET_PROGRAMS)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_PROGRAMS))) +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) +ifeq ($(OS_TARGET),os2) +override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_PROGRAMS)) +endif +endif +fpc_exes: $(EXEFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_packages fpc_all fpc_smart fpc_debug +$(FPCMADE): $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_packages: $(COMPILEPACKAGES) +fpc_all: fpc_packages $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES))) +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR) $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) +fpc_distclean: clean +ifdef COMPILER_UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +.PHONY: fpc_info +fpc_info: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(ECHO) Target OS.... $(OS_TARGET) + @$(ECHO) Full Target.. $(FULL_SOURCE) + @$(ECHO) Full Source.. $(FULL_TARGET) + @$(ECHO) + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders...... $(TARGET_LOADERS) + @$(ECHO) Target Units........ $(TARGET_UNITS) + @$(ECHO) Target Programs..... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs......... $(TARGET_DIRS) + @$(ECHO) Target Examples..... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.. $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) + @$(ECHO) DateStr.............. $(DATESTR) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) + @$(ECHO) + @$(ECHO) Install base dir..... $(INSTALL_BASEDIR) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +all: fpc_all +debug: fpc_debug +smart: fpc_smart +examples: +shared: +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: +zipinstall: +zipsourceinstall: +zipexampleinstall: +zipdistinstall: +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +.PHONY: all debug smart examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif diff --git a/examples/gfx/imgtest/Makefile.fpc b/examples/gfx/imgtest/Makefile.fpc new file mode 100644 index 00000000..34f0d45e --- /dev/null +++ b/examples/gfx/imgtest/Makefile.fpc @@ -0,0 +1,15 @@ +# +# Makefile.fpc for fpGFX example "ImgTest" +# + +[target] +programs=imgtest + +[require] +packages=fcl fpgfx +packages_linux=fpgfx_x11 +packages_freebsd=fpgfx_x11 +packages_netbsd=fpgfx_x11 + +[compiler] +options=-S2h diff --git a/examples/gfx/imgtest/imgtest.lpi b/examples/gfx/imgtest/imgtest.lpi new file mode 100644 index 00000000..27e5772c --- /dev/null +++ b/examples/gfx/imgtest/imgtest.lpi @@ -0,0 +1,49 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + </General> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpgfxpackage"/> + <MinVersion Minor="3" Valid="True"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="imgtest.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="ImgTest"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/gfx/imgtest/imgtest.pas b/examples/gfx/imgtest/imgtest.pas new file mode 100644 index 00000000..98e9cecb --- /dev/null +++ b/examples/gfx/imgtest/imgtest.pas @@ -0,0 +1,87 @@ +{ + fpGUI - Free Pascal GUI Library + + Image Test example + + Copyright (C) 2000 - 2006 See the file AUTHORS, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + 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. +} + +program ImgTest; + +uses + Classes, + GFXBase, + fpGFX; + +type + TMainWindow = class(TFWindow) + procedure Paint(Sender: TObject; const Rect: TRect); + private + Image: TFImage; + public + constructor Create; + destructor Destroy; override; + end; + + +constructor TMainWindow.Create; +var + Data: Pointer; + Stride: LongWord; + i, j: Integer; +begin + inherited Create(nil, [woWindow]); + + Title := 'fpGFX Bitmap Test'; + OnPaint := @Paint; + SetClientSize(Size(256, 256)); + SetMinMaxClientSize(Size(256, 256), Size(256, 256)); + + Image := TFImage.Create(256, 256, PixelFormatRGB32); + Image.Lock(Data, Stride); + for j := 0 to 255 do + for i := 0 to 255 do + PLongWord(Data)[j * 256 + i] := (i shl 16) or (j shl 8); + Image.Unlock; +end; + +destructor TMainWindow.Destroy; +begin + Image.Free; + inherited Destroy; +end; + +procedure TMainWindow.Paint(Sender: TObject; const Rect: TRect); +var + r: TRect; +begin + Canvas.SetColor(colBlue); + r.Left := 0; + r.Top := 0; + r.Right := Width; + r.Bottom := Height; + Canvas.FillRect(r); + Canvas.DrawImage(Image, Point(0, 0)); +end; + + +var + MainWindow: TMainWindow; + +begin + gApplication.Initialize; + MainWindow := TMainWindow.Create; + gApplication.AddWindow(MainWindow); + MainWindow.Show; + gApplication.Run; +end. + + diff --git a/examples/gui/concepttest/OpenSoftStyle.pas b/examples/gui/concepttest/OpenSoftStyle.pas new file mode 100644 index 00000000..6d2b65f8 --- /dev/null +++ b/examples/gui/concepttest/OpenSoftStyle.pas @@ -0,0 +1,254 @@ +unit OpenSoftStyle; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, fpgui, gfxbase; + +type + + TGradientDirection = (gdTopToBottom, gdBottomToTop, gdLeftToRight, gdRightToLeft); + TCalcGradientEndX = function(Y, H: Integer): Integer; + + + TOpenSoftStyle = class(TDefaultStyle) + private + procedure PaintGradient(pCanvas: TGfxCanvas; const R: TRect; StartColor, EndColor: TColor; Direction: TGradientDirection; GradLines: Integer = -1); + public + // Colors + function GetGUIColor(Color: TColor): TGfxColor; override; + // Buttons (todo) + procedure DrawButtonFace(Canvas: TGfxCanvas; const ARect: TRect; Flags: TButtonFlags); override; + // GroupBox + procedure DrawGroupBox(Canvas: TGfxCanvas; const ARect: TRect; const ALabel: String; WidgetState: TWidgetState); override; + end; + + +var + FOpenSoftStyle: TOpenSoftStyle; + +implementation + + +const + // Some predefined colors: + rgbaDkBlue: TGfxColor = (Red: $0000; Green: $0000; Blue: $8000; Alpha: $0000); + rgbaLtYellow: TGfxColor = (Red: $ffff; Green: $ffff; Blue: $e100; Alpha: $0000); + + rgbaWindowText: TGfxColor = (Red: $0000; Green: $0000; Blue: $0000; Alpha: $0000); + rgbaWindow: TGfxColor = (Red: $efef; Green: $efef; Blue: $efef; Alpha: $0000); + rgbaDkGrey: TGfxColor = (Red: $8686; Green: $8686; Blue: $8686; Alpha: $0000); + rgbaGbAALtGrey: TGfxColor = (Red: $baba; Green: $baba; Blue: $baba; Alpha: $0000); + rgbaGbAADkGrey: TGfxColor = (Red: $7878; Green: $7878; Blue: $7878; Alpha: $0000); + + +{ +procedure DrawGradient(Canvas: TCanvas; const R: TRect; StartColor, EndColor: TColor; + Direction: TGradientDirection; GradLines: Integer = -1; CalcEndX: TCalcGradientEndX = nil); +procedure DrawGradientEx(Canvas: TCanvas; const R: TRect; StartColor: TColor; + StartToMidHeight: Integer; MidColor, EndColor: TColor; + Direction: TGradientDirection; CalcEndX: TCalcGradientEndX = nil); + + +procedure ToRGB(c: TColor; out rgb: TRGB); +var + l: TColorRef; +begin + c := ColorFromColormap(c); + l := ColorToRGB(c); + rgb.r := TRGBValue(l).r; + rgb.g := TRGBValue(l).g; + rgb.b := TRGBValue(l).b; +end; +} + + +{ TOpenSoftStyle } + +procedure TOpenSoftStyle.PaintGradient(pCanvas: TGfxCanvas; const R: TRect; StartColor, EndColor: TColor; Direction: TGradientDirection; GradLines: Integer = -1); +var + X, i, w, h, Count: Integer; + EndCol, StartCol, AddCol, Tmp: TGfxColor; +begin + w := R.Right - R.Left - 1; + h := R.Bottom - R.Top - 1; + if (w <= 0) or (h <= 0) then + Exit; //==> + + StartCol := GetGUIColor(StartColor); + EndCol := GetGUIColor(EndColor); + + case Direction of + gdTopToBottom: + Count := h; + gdLeftToRight: + Count := w; + gdBottomToTop: + begin + Count := h; + Tmp := EndCol; + EndCol := StartCol; + StartCol := Tmp; + end; + gdRightToLeft: + begin + Count := w; + Tmp := EndCol; + EndCol := StartCol; + StartCol := Tmp; + end; + else + Exit; //==> + end; + if GradLines < 0 then + GradLines := Count; + + AddCol.r := (EndCol.r - StartCol.r) / GradLines; + AddCol.g := (EndCol.g - StartCol.g) / GradLines; + AddCol.b := (EndCol.b - StartCol.b) / GradLines; + +// Canvas.Pen.Style := psSolid; + pCanvas.SaveState; +// Canvas.Start; + try + StartColor := TColor(Round(StartCol.r), Round(StartCol.g), Round(StartCol.b)); +// Canvas.Pen.Color := StartColor; + pCanvas.SetColor(GetGUIColor(StartColor)); + for i := 0 to Count - 1 do + begin + if Direction in [gdTopToBottom, gdBottomToTop] then + begin + Canvas.MoveTo(R.Left, R.Top + i); + if Assigned(CalcEndX) then + X := CalcEndX(i, Count) + else + X := 0; + Canvas.LineTo(R.Right + X, R.Top + i); + end + else + begin + Canvas.MoveTo(R.Left + i, R.Top); + Canvas.LineTo(R.Left + i, R.Bottom); + end; + StartCol.r := StartCol.r + AddCol.r; + StartCol.g := StartCol.g + AddCol.g; + StartCol.b := StartCol.b + AddCol.b; + EndColor := RGB(Round(StartCol.r), Round(StartCol.g), Round(StartCol.b)); + if StartColor <> EndColor then + begin +// Canvas.Pen.Color := EndColor; + pCanvas.SetColor(GetGUIColor(EndColor)); + StartColor := EndColor; + end; + end; // for + finally +// Canvas.Stop; + pCanvas.RestoreState; + end; +end; + + +function TOpenSoftStyle.GetGUIColor(Color: TColor): TGfxColor; +begin + Result := inherited GetGUIColor(Color); + case Color of + // UI element colors + clScrollBar: Result := rgbaWindow; + clMenu: Result := rgbaWindow; +// clWindow: Result := GetUIColor(clWhite); +// clMenuText: Result := GetUIColor(clBlack); +// clWindowText: Result := GetUIColor(clBlack); +// clAppWorkSpace: Result := GetUIColor(clGray); +// clHighlight: Result := GetUIColor(clNavy); +// clHighlightText: Result := GetUIColor(clWhite); + cl3DFace: Result := rgbaWindow; +// cl3DShadow: Result := rgbaDkWhite; +// clGrayText: Result := GetUIColor(clGray); +// clBtnText: Result := GetUIColor(clBlack); +// cl3DHighlight: Result := GetUIColor(clWhite); + cl3DDkShadow: Result := GetUIColor(clMidnightBlue); +// cl3DLight: Result := GetUIColor(clDarkWhite); +// clInfoText: Result := GetUIColor(clBlack); +// clInfoBk: Result := GetUIColor(clLightYellow); +// +// else Result := GetUIColor(clWhite); + end; + +end; + + +procedure TOpenSoftStyle.DrawButtonFace(Canvas: TGfxCanvas; const ARect: TRect; + Flags: TButtonFlags); +begin +// inherited DrawButtonFace(Canvas, ARect, Flags); + PaintGradient(Canvas, ARect, Flags); + Draw3DFrame(Canvas, ARect, cl3DHighlight, cl3DLight, cl3DDkShadow, cl3DShadow); +end; + + +procedure TOpenSoftStyle.DrawGroupBox(Canvas: TGfxCanvas; const ARect: TRect; + const ALabel: String; WidgetState: TWidgetState); +var + TitleWidth, TitleHeight, TopLine: Integer; +begin + TitleWidth := Canvas.TextWidth(ALabel); + TitleHeight := Canvas.FontCellHeight; + TopLine := ARect.Top + TitleHeight div 3; + + Canvas.SetColor(rgbaDkGrey); + // box outline + with ARect do + begin + // top + Canvas.DrawLine(Point(Left + 2, TopLine), Point(Left + 12, TopLine)); + Canvas.DrawLine(Point(Left + TitleWidth + 16, TopLine), Point(Right - 2, TopLine)); + // right + Canvas.DrawLine(Point(Right-1, TopLine + 2), Point(Right-1, Bottom - 2)); + // bottom + Canvas.DrawLine(Point(Right - 3, Bottom-1), Point(Left + 1, Bottom-1)); + // left + Canvas.DrawLine(Point(Left, Bottom - 3), Point(Left, TopLine + 1)); + end; + + // Text caption + SetUIColor(Canvas, clWindowText); + DrawText(Canvas, ARect.TopLeft + Point(14, 0), ALabel, WidgetState); + + { Anti-Aliasing - Top/Left } + Canvas.SetColor(rgbaGbAALtGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(0, TopLine+1)); + Canvas.DrawPoint(ARect.TopLeft + Point(1, TopLine)); + Canvas.SetColor(rgbaGbAADkGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(1, TopLine+1)); + { Anti-Aliasing - Top/Right } + Canvas.SetColor(rgbaGbAALtGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-1, TopLine+1)); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, TopLine)); + Canvas.SetColor(rgbaGbAADkGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, TopLine+1)); + { Anti-Aliasing - Bottom/Right } + Canvas.SetColor(rgbaGbAALtGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-1, ARect.Bottom-2)); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, ARect.Bottom-1)); + Canvas.SetColor(rgbaGbAADkGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, ARect.Bottom-2)); + { Anti-Aliasing - Bottom/Left } + Canvas.SetColor(rgbaGbAALtGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(0, ARect.Bottom-2)); + Canvas.DrawPoint(ARect.TopLeft + Point(1, ARect.Bottom-1)); + Canvas.SetColor(rgbaGbAADkGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(1, ARect.Bottom-2)); +end; + + +initialization + FOpenSoftStyle := TOpenSoftStyle.Create(Application.Display); + +finalization + if Assigned(FOpenSoftStyle) then + FOpenSoftStyle.Free; + +end. + diff --git a/examples/gui/concepttest/compileroptform.frm b/examples/gui/concepttest/compileroptform.frm new file mode 100644 index 00000000..1aae5daa --- /dev/null +++ b/examples/gui/concepttest/compileroptform.frm @@ -0,0 +1,137 @@ +object CompilerOptForm: TCompilerOptForm + Text = 'Compiler Options - Code' + BorderWidth = 5 + object Box1: TBoxLayout + Spacing = 8 + Orientation = Vertical + object Box2: TBoxLayout + Orientation = Vertical + Spacing = 4 + object Box4: TBoxLayout + object grpBox1: TGroupBox + Text = 'Unit Style:' + object grpBox1VBox1: TBoxLayout + Orientation = Vertical + object cbSmartLink: TCheckbox + Checked = True + Text = 'Smart Linkable (-CX)' + end + end + end + object grpBox2: TGroupBox + Text = 'Checks:' + object grpBox2VBox1: TBoxLayout + Orientation = Vertical + object rbIO: TRadioButton + Checked = True + Text = 'I/O (-Ci)' + end + object rbOverflow: TRadioButton + Checked = True + Text = 'Overflow (-Co)' + end + object rbRange: TRadioButton + Checked = True + Text = 'Range (-Cr)' + end + object rbStack: TRadioButton + Checked = True + Text = 'Stack (-Ct)' + end + end + end + object grpBox3: TGroupBox + Text = 'Heap Size (-Ch):' + object grpBox3VBox1: TBoxLayout + Orientation = Vertical + object edHeapSize: TEdit + Text = '0' + CanExpandWidth = False + end + end + end + end + object Box5: TBoxLayout + object grpBox4: TGroupBox + Text = 'Generate:' + object grpBox4VBox1: TBoxLayout + Orientation = Vertical + object rbNormal: TRadioButton + Text = 'Normal Code (none)' + end + object rbFaster: TRadioButton + Checked = True + Text = 'Faster Code (-OG)' + end + object rbSmaller: TRadioButton + Text = 'Smaller Code (-Og)' + end + end + end + object grpBox5: TGroupBox + Text = 'Target Platform:' + CanExpandHeight = True + object grpBox5VBox1: TBoxLayout + Orientation = Vertical + VertAlign = vertTop + object lblTarget1: TLabel + Text = 'Target OS (-T)' + end + object lblTarget2: TLabel + Text = 'Target CPU (-P)' + end + object lblTarget3: TLabel + Text = 'Target i386' + end + end + end + end + object Box6: TBoxLayout + object grpBox6: TGroupBox + Text = 'Optimizations:' + object grpBox6VBox1: TBoxLayout + Orientation = Vertical + CanExpandWidth = True + object rbLevel0: TRadioButton + Text = 'Level 0 (no extra Optimizations) (none)' + end + object rbLevel1: TRadioButton + Checked = True + Text = 'Level 1 (Quick Optimizations) (-O1)' + end + object rbLevel2: TRadioButton + Text = 'Level 2 (Level 1 + Slower Optimizations) (-O2)' + end + object rbLevel3: TRadioButton + Text = 'Level 3 (Level 2 + Uncertain) (-O3)' + end + object rbKeepVarReg: TCheckbox + Text = 'Keep certain variables in registers (-Or)' + end + object rbUncOpt: TCheckbox + Text = 'Uncertain Optimizations (-Ou)' + end + end + end + end + end + object Box3: TBoxLayout + object btnOK: TButton + Text = 'OK' + OnClick = btnCloseClick + end + object btnCancel: TButton + Text = 'Cancel' + end + object btnShowOpt: TButton + Text = 'Show Options' + end + object btnTest: TButton + Text = 'Test' + end + object btnLoadSave: TButton + Text = 'Load/Save' + end + end + end +end diff --git a/examples/gui/concepttest/frmCompilerOpt.pas b/examples/gui/concepttest/frmCompilerOpt.pas new file mode 100644 index 00000000..b2f84a6f --- /dev/null +++ b/examples/gui/concepttest/frmCompilerOpt.pas @@ -0,0 +1,132 @@ +unit frmCompilerOpt; + +{$mode objfpc}{$H+} + +interface +uses + Classes, SysUtils, fpgui; + + +type + + { TCompilerOptForm } + + TCompilerOptForm = Class(TForm) + private + FGroupBoxStyle: TStyle; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure CompOptFormOnActivate(Sender: TObject); + procedure SmartLinkClick(Sender: TObject); + published + procedure btnCloseClick(Sender: TObject); + Box1: TBoxLayout; + Box2: TBoxLayout; + Box3: TBoxLayout; + Box4: TBoxLayout; + Box5: TBoxLayout; + Box6: TBoxLayout; + btnOK, btnCancel, btnShowOp, btnTest, btnLoadSave : TButton; + grpBox1: TGroupBox; + grpBox1VBox1: TBoxLayout; + cbSmartLink: TCheckbox; + grpBox2: TGroupBox; + grpBox2VBox1: TBoxLayout; + rbIO: TRadioButton; + rbOverflow: TRadioButton; + rbRange: TRadioButton; + rbStack: TRadioButton; + grpBox3: TGroupBox; + grpBox3VBox1: TBoxLayout; + edHeapSize: TEdit; + grpBox4: TGroupBox; + grpBox4VBox1: TBoxLayout; + rbNormal: TRadioButton; + rbFaster: TRadioButton; + rbSmaller: TRadioButton; + grpBox5: TGroupBox; + grpBox5VBox1: TBoxLayout; + lblTarget1: TLabel; + lblTarget2: TLabel; + lblTarget3: TLabel; + grpBox6: TGroupBox; + grpBox6VBox1: TBoxLayout; + rbLevel0: TRadioButton; + rbLevel1: TRadioButton; + rbLevel2: TRadioButton; + rbLevel3: TRadioButton; + rbKeepVarReg: TCheckbox; + rbUncOpt: TCheckbox; + end; + +var + CompOpt: TCompilerOptForm; + +implementation +uses + OpenSoftStyle; + +{ TCompilerOptForm } + + + +constructor TCompilerOptForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); +// FGroupBoxStyle := TOpenSoftStyle.Create(Application.Display); +// Style := FGroupBoxStyle; +// Style := FOpenSoftStyle; + OnActivate := @CompOptFormOnActivate; +end; + + +destructor TCompilerOptForm.Destroy; +begin + FGroupBoxStyle.Free; + inherited Destroy; +end; + + +procedure TCompilerOptForm.CompOptFormOnActivate(Sender: TObject); +begin + cbSmartLink.OnClick := @SmartLinkClick; + +{ + grpBox1.CanExpandHeight := True; + grpBox1VBox1.CanExpandHeight := True; + grpBox1.CanExpandWidth := True; + grpBox2.CanExpandWidth := True; + grpBox3.CanExpandWidth := True; + grpBox4.CanExpandWidth := True; + grpBox5.CanExpandWidth := True; + grpBox6.CanExpandWidth := True; + + grpBox6VBox1.CanExpandWidth := True; +} + grpBox5VBox1.VertAlign := vertFill; +// grpBox1.Style := FGroupBoxStyle; +// grpBox6.Style := FGroupBoxStyle; +end; + + +procedure TCompilerOptForm.SmartLinkClick(Sender: TObject); +begin + grpBox1.Style := nil; + self.Redraw; +// grpBox1.Redraw; +end; + + +procedure TCompilerOptForm.btnCloseClick(Sender: TObject); +begin + Close; +end; + + +initialization +finalization + CompOpt.Free; + +end. + diff --git a/examples/gui/concepttest/hello.lpi b/examples/gui/concepttest/hello.lpi new file mode 100644 index 00000000..be68c070 --- /dev/null +++ b/examples/gui/concepttest/hello.lpi @@ -0,0 +1,458 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="\"/> + <Version Value="5"/> + <General> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + <ActiveEditorIndexAtStart Value="1"/> + </General> + <PublishOptions> + <Version Value="2"/> + <DestinationDirectory Value="$(TestDir)\publishedproject\"/> + <IgnoreBinaries Value="False"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpGUI_laz"/> + </Item1> + </RequiredPackages> + <Units Count="59"> + <Unit0> + <Filename Value="hello.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="hello"/> + <CursorPos X="25" Y="286"/> + <TopLine Value="270"/> + <EditorIndex Value="0"/> + <UsageCount Value="136"/> + <Loaded Value="True"/> + </Unit0> + <Unit1> + <Filename Value="..\..\src\applicationh.inc"/> + <CursorPos X="18" Y="27"/> + <TopLine Value="1"/> + <UsageCount Value="13"/> + </Unit1> + <Unit2> + <Filename Value="..\..\src\application.inc"/> + <CursorPos X="17" Y="37"/> + <TopLine Value="73"/> + <EditorIndex Value="4"/> + <UsageCount Value="29"/> + <Loaded Value="True"/> + </Unit2> + <Unit3> + <Filename Value="..\..\src\formh.inc"/> + <CursorPos X="1" Y="83"/> + <TopLine Value="50"/> + <UsageCount Value="19"/> + </Unit3> + <Unit4> + <Filename Value="..\..\src\fpgui.pp"/> + <UnitName Value="fpGUI"/> + <CursorPos X="18" Y="136"/> + <TopLine Value="233"/> + <UsageCount Value="55"/> + </Unit4> + <Unit5> + <Filename Value="..\..\src\form.inc"/> + <CursorPos X="31" Y="112"/> + <TopLine Value="97"/> + <EditorIndex Value="5"/> + <UsageCount Value="24"/> + <Loaded Value="True"/> + </Unit5> + <Unit6> + <Filename Value="..\..\..\fpgfx\src\gfxbase.pp"/> + <UnitName Value="GfxBase"/> + <CursorPos X="3" Y="41"/> + <TopLine Value="24"/> + <UsageCount Value="6"/> + </Unit6> + <Unit7> + <Filename Value="..\layouttest\layouttest.pp"/> + <UnitName Value="LayoutTest"/> + <CursorPos X="16" Y="7"/> + <TopLine Value="1"/> + <UsageCount Value="10"/> + </Unit7> + <Unit8> + <Filename Value="..\layouttest\mainform.frm"/> + <CursorPos X="1" Y="1"/> + <TopLine Value="1"/> + <UsageCount Value="10"/> + <SyntaxHighlighter Value="None"/> + </Unit8> + <Unit9> + <Filename Value="..\..\src\layoutsh.inc"/> + <CursorPos X="15" Y="156"/> + <TopLine Value="131"/> + <UsageCount Value="23"/> + </Unit9> + <Unit10> + <Filename Value="..\..\src\widgeth.inc"/> + <CursorPos X="1" Y="264"/> + <TopLine Value="219"/> + <UsageCount Value="21"/> + </Unit10> + <Unit11> + <Filename Value="..\..\src\widget.inc"/> + <CursorPos X="9" Y="1356"/> + <TopLine Value="1311"/> + <EditorIndex Value="6"/> + <UsageCount Value="45"/> + <Loaded Value="True"/> + </Unit11> + <Unit12> + <Filename Value="..\..\src\buttonsh.inc"/> + <CursorPos X="19" Y="39"/> + <TopLine Value="11"/> + <UsageCount Value="1"/> + </Unit12> + <Unit13> + <Filename Value="..\..\src\buttons.inc"/> + <CursorPos X="3" Y="77"/> + <TopLine Value="56"/> + <UsageCount Value="10"/> + </Unit13> + <Unit14> + <Filename Value="frmCompilerOpt.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="frmCompilerOpt"/> + <CursorPos X="35" Y="107"/> + <TopLine Value="1"/> + <EditorIndex Value="2"/> + <UsageCount Value="135"/> + <Loaded Value="True"/> + </Unit14> + <Unit15> + <Filename Value="..\..\src\groupboxh.inc"/> + <CursorPos X="15" Y="21"/> + <TopLine Value="1"/> + <UsageCount Value="19"/> + </Unit15> + <Unit16> + <Filename Value="compileroptform.frm"/> + <IsPartOfProject Value="True"/> + <CursorPos X="43" Y="66"/> + <TopLine Value="1"/> + <UsageCount Value="135"/> + <SyntaxHighlighter Value="None"/> + </Unit16> + <Unit17> + <Filename Value="..\layouttest\boxform.frm"/> + <CursorPos X="27" Y="6"/> + <TopLine Value="1"/> + <UsageCount Value="33"/> + <SyntaxHighlighter Value="None"/> + </Unit17> + <Unit18> + <Filename Value="..\widgettest\groupboxform.frm"/> + <CursorPos X="9" Y="18"/> + <TopLine Value="1"/> + <UsageCount Value="18"/> + <SyntaxHighlighter Value="None"/> + </Unit18> + <Unit19> + <Filename Value="..\..\src\binh.inc"/> + <CursorPos X="1" Y="18"/> + <TopLine Value="1"/> + <UsageCount Value="6"/> + </Unit19> + <Unit20> + <Filename Value="..\..\src\containerh.inc"/> + <CursorPos X="1" Y="3"/> + <TopLine Value="1"/> + <UsageCount Value="6"/> + </Unit20> + <Unit21> + <Filename Value="opt\fpc-2.1.1\src\rtl\objpas\classes\classesh.inc"/> + <CursorPos X="3" Y="104"/> + <TopLine Value="81"/> + <UsageCount Value="1"/> + </Unit21> + <Unit22> + <Filename Value="..\..\src\checkboxh.inc"/> + <CursorPos X="1" Y="42"/> + <TopLine Value="20"/> + <UsageCount Value="13"/> + </Unit22> + <Unit23> + <Filename Value="..\..\src\groupbox.inc"/> + <CursorPos X="32" Y="26"/> + <TopLine Value="12"/> + <UsageCount Value="16"/> + </Unit23> + <Unit24> + <Filename Value="..\..\src\styleh.inc"/> + <CursorPos X="20" Y="86"/> + <TopLine Value="68"/> + <UsageCount Value="19"/> + </Unit24> + <Unit25> + <Filename Value="..\..\src\style.inc"/> + <CursorPos X="17" Y="103"/> + <TopLine Value="80"/> + <UsageCount Value="25"/> + </Unit25> + <Unit26> + <Filename Value="OpenSoftStyle.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="OpenSoftStyle"/> + <CursorPos X="10" Y="108"/> + <TopLine Value="95"/> + <EditorIndex Value="1"/> + <UsageCount Value="122"/> + <Loaded Value="True"/> + </Unit26> + <Unit27> + <Filename Value="..\..\src\bin.inc"/> + <CursorPos X="29" Y="25"/> + <TopLine Value="2"/> + <UsageCount Value="7"/> + </Unit27> + <Unit28> + <Filename Value="..\widgettest\editform.frm"/> + <CursorPos X="1" Y="1"/> + <TopLine Value="1"/> + <UsageCount Value="4"/> + <SyntaxHighlighter Value="None"/> + </Unit28> + <Unit29> + <Filename Value="..\widgettest\widgettest.pp"/> + <UnitName Value="WidgetTest"/> + <CursorPos X="1" Y="497"/> + <TopLine Value="461"/> + <UsageCount Value="6"/> + </Unit29> + <Unit30> + <Filename Value="..\..\src\separatorh.inc"/> + <CursorPos X="15" Y="26"/> + <TopLine Value="3"/> + <UsageCount Value="4"/> + </Unit30> + <Unit31> + <Filename Value="..\..\src\separator.inc"/> + <CursorPos X="19" Y="32"/> + <TopLine Value="30"/> + <UsageCount Value="4"/> + </Unit31> + <Unit32> + <Filename Value="..\..\src\layouts.inc"/> + <CursorPos X="17" Y="871"/> + <TopLine Value="613"/> + <EditorIndex Value="3"/> + <UsageCount Value="29"/> + <Loaded Value="True"/> + </Unit32> + <Unit33> + <Filename Value="..\..\src\win32\defstyle.inc"/> + <CursorPos X="1" Y="1"/> + <TopLine Value="1"/> + <UsageCount Value="4"/> + </Unit33> + <Unit34> + <Filename Value="..\..\src\defimpl\defstyle.inc"/> + <CursorPos X="42" Y="57"/> + <TopLine Value="23"/> + <UsageCount Value="12"/> + </Unit34> + <Unit35> + <Filename Value="..\..\..\fpGFX\src\x11\gfx_x11.pp"/> + <UnitName Value="GFX_X11"/> + <CursorPos X="14" Y="499"/> + <TopLine Value="470"/> + <UsageCount Value="5"/> + </Unit35> + <Unit36> + <Filename Value="..\..\..\lptk\src\gfxstyle.pas"/> + <UnitName Value="gfxstyle"/> + <CursorPos X="39" Y="7"/> + <TopLine Value="93"/> + <UsageCount Value="5"/> + </Unit36> + <Unit37> + <Filename Value="..\..\..\lptk\src\gfxwidget.pas"/> + <UnitName Value="gfxwidget"/> + <CursorPos X="1" Y="1"/> + <TopLine Value="737"/> + <UsageCount Value="25"/> + </Unit37> + <Unit38> + <Filename Value="..\..\src\container.inc"/> + <CursorPos X="31" Y="25"/> + <TopLine Value="2"/> + <UsageCount Value="15"/> + </Unit38> + <Unit39> + <Filename Value="..\..\src\gridh.inc"/> + <CursorPos X="1" Y="137"/> + <TopLine Value="103"/> + <UsageCount Value="6"/> + </Unit39> + <Unit40> + <Filename Value="..\..\src\grid.inc"/> + <CursorPos X="3" Y="18"/> + <TopLine Value="1"/> + <UsageCount Value="7"/> + </Unit40> + <Unit41> + <Filename Value="media\sda5\Programming\MasterMaths\M2Browser_v3\3rdParty\Gauge\TGauge.pas"/> + <UnitName Value="TGauge"/> + <CursorPos X="39" Y="3"/> + <TopLine Value="90"/> + <UsageCount Value="7"/> + </Unit41> + <Unit42> + <Filename Value="..\..\src\checkbox.inc"/> + <CursorPos X="3" Y="89"/> + <TopLine Value="83"/> + <UsageCount Value="12"/> + </Unit42> + <Unit43> + <Filename Value="..\..\src\combobox.inc"/> + <CursorPos X="24" Y="171"/> + <TopLine Value="148"/> + <UsageCount Value="6"/> + </Unit43> + <Unit44> + <Filename Value="..\..\..\personal\fpgui\src\form.inc"/> + <CursorPos X="27" Y="121"/> + <TopLine Value="101"/> + <UsageCount Value="6"/> + </Unit44> + <Unit45> + <Filename Value="..\..\src\radiobutton.inc"/> + <CursorPos X="19" Y="107"/> + <TopLine Value="85"/> + <UsageCount Value="12"/> + </Unit45> + <Unit46> + <Filename Value="..\..\..\lptk\src\gfxbase.pas"/> + <UnitName Value="gfxbase"/> + <CursorPos X="38" Y="2355"/> + <TopLine Value="3421"/> + <UsageCount Value="25"/> + </Unit46> + <Unit47> + <Filename Value="..\..\..\lptk\src\schar16.pas"/> + <UnitName Value="schar16"/> + <CursorPos X="10" Y="35"/> + <TopLine Value="1"/> + <UsageCount Value="7"/> + </Unit47> + <Unit48> + <Filename Value="..\..\..\lptk\src\unitkeys.pas"/> + <UnitName Value="unitkeys"/> + <CursorPos X="1" Y="1"/> + <TopLine Value="302"/> + <UsageCount Value="7"/> + </Unit48> + <Unit49> + <Filename Value="..\..\..\lptk\src\wgbutton.pas"/> + <UnitName Value="wgbutton"/> + <CursorPos X="15" Y="34"/> + <TopLine Value="11"/> + <UsageCount Value="7"/> + </Unit49> + <Unit50> + <Filename Value="..\..\..\lptk\src\wglabel.pas"/> + <UnitName Value="wglabel"/> + <CursorPos X="1" Y="1"/> + <TopLine Value="1"/> + <UsageCount Value="7"/> + </Unit50> + <Unit51> + <Filename Value="..\..\src\colors.inc"/> + <CursorPos X="1" Y="1"/> + <TopLine Value="39"/> + <EditorIndex Value="7"/> + <UsageCount Value="24"/> + <Loaded Value="True"/> + </Unit51> + <Unit52> + <Filename Value="..\..\..\fpgfx.trunk\src\gfxbase.pp"/> + <UnitName Value="GfxBase"/> + <CursorPos X="19" Y="402"/> + <TopLine Value="507"/> + <UsageCount Value="8"/> + </Unit52> + <Unit53> + <Filename Value="\opt\lazarus\ide\editoroptions.pp"/> + <ComponentName Value="EditorOptionsForm"/> + <HasResources Value="True"/> + <ResourceFilename Value="\opt\lazarus\ide\editoroptions.lrs"/> + <UnitName Value="EditorOptions"/> + <CursorPos X="28" Y="2302"/> + <TopLine Value="2595"/> + <UsageCount Value="21"/> + </Unit53> + <Unit54> + <Filename Value="\opt\lazarus\components\synedit\synedit.pp"/> + <UnitName Value="SynEdit"/> + <CursorPos X="28" Y="6001"/> + <TopLine Value="5978"/> + <UsageCount Value="21"/> + </Unit54> + <Unit55> + <Filename Value="\opt\lazarus\components\synedit\synedittextbuffer.pp"/> + <UnitName Value="SynEditTextBuffer"/> + <CursorPos X="15" Y="135"/> + <TopLine Value="181"/> + <UsageCount Value="21"/> + </Unit55> + <Unit56> + <Filename Value="\opt\lazarus\components\synedit\synedithighlighter.pp"/> + <UnitName Value="SynEditHighlighter"/> + <CursorPos X="34" Y="145"/> + <TopLine Value="766"/> + <UsageCount Value="21"/> + </Unit56> + <Unit57> + <Filename Value="\opt\lazarus\components\synedit\synhighlighterpas.pp"/> + <UnitName Value="SynHighlighterPas"/> + <CursorPos X="3" Y="83"/> + <TopLine Value="658"/> + <UsageCount Value="21"/> + </Unit57> + <Unit58> + <Filename Value="..\..\..\tiOPF2\Source\Core\tiObject.pas"/> + <UnitName Value="tiObject"/> + <CursorPos X="1" Y="1756"/> + <TopLine Value="1933"/> + <UsageCount Value="19"/> + </Unit58> + </Units> + <JumpHistory Count="2" HistoryIndex="1"> + <Position1> + <Filename Value="OpenSoftStyle.pas"/> + <Caret Line="34" Column="1" TopLine="1"/> + </Position1> + <Position2> + <Filename Value="OpenSoftStyle.pas"/> + <Caret Line="108" Column="10" TopLine="95"/> + </Position2> + </JumpHistory> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <PathDelim Value="\"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/gui/concepttest/hello.lpr b/examples/gui/concepttest/hello.lpr new file mode 100644 index 00000000..0ac8138a --- /dev/null +++ b/examples/gui/concepttest/hello.lpr @@ -0,0 +1,334 @@ +program hello; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, + fpgui, gfxbase, frmCompilerOpt, OpenSoftStyle; + +type + + { TMainForm } + + TMainForm = class(TForm) + procedure Button3Clicked(Sender: TObject); + private + procedure btnCloseClick(Sender: TObject); + procedure btnGridFormClick(Sender: TObject); + procedure btnCompOptClick(Sender: TObject); + procedure btnTopClick(Sender: TObject); + procedure MainFormActivate(Sender: TObject); + public + constructor Create(AOwner: TComponent); override; + published + HBox: TBoxLayout; + VBox: TBoxLayout; + TextLabel: TLabel; + Button: TButton; + btnGridForm: TButton; + btnCompOpt: TButton; + Button1: TButton; + Button2: TButton; + Button3: TButton; + end; + + + { TGridForm } + + TGridForm = Class(TForm) + Layout : TGridLayout; + Button1,Button2,Button3,Button4,Button5 : TButton; + public + constructor Create(AOwner: TComponent); override; + end; + + + { TFindDialog } + + TFindDialog = class(TForm) + private + procedure btnCloseClick(Sender: TObject); + public + constructor Create(AOwner: TComponent); override; + published + lblFind: TLabel; + btnFindNext, btnClose: TButton; + edFind: TEdit; + GroupBox1: TGroupBox; + grpBox1Layout: TBoxLayout; + Radio1, Radio2: TRadioButton; + cbCase: TCheckBox; + leftLayout, rightLayout: TBoxLayout; + topLeftLayout: TBoxLayout; + mainLayout: TBoxLayout; + end; + + +{ TFindDialog } + +procedure TFindDialog.btnCloseClick(Sender: TObject); +begin + Close; +end; + + +constructor TFindDialog.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Text := 'Find Dialog'; + BorderWidth := 8; + WindowType := wtWindow; + + topLeftLayout := TBoxLayout.Create(self); + lblFind := TLabel.Create(self); + lblFind.Text := 'Find what'; + edFind := TEdit.Create(self); + topLeftLayout.InsertChild(lblFind); + topLeftLayout.InsertChild(edFind); + + leftLayout := TBoxLayout.Create(self); + leftLayout.Orientation := Vertical; + leftLayout.CanExpandHeight := True; + GroupBox1 := TGroupBox.Create(self); + GroupBox1.Text := 'Direction'; + grpBox1Layout := TBoxLayout.Create(self); +// grpBox1Layout.Orientation := Vertical; + GroupBox1.InsertChild(grpBox1Layout); + Radio1 := TRadioButton.Create(self); + Radio1.Text := 'Up'; + Radio2 := TRadioButton.Create(self); + Radio2.Text := 'Down'; + grpBox1Layout.InsertChild(Radio1); + grpBox1Layout.InsertChild(Radio2); + + cbCase := TCheckBox.Create(self); + cbCase.Text := 'Case sensitive'; + leftLayout.InsertChild(topLeftLayout); + leftLayout.InsertChild(GroupBox1); + leftLayout.InsertChild(cbCase); + + rightLayout := TBoxLayout.Create(self); + rightLayout.Orientation := Vertical; + rightLayout.VertAlign := vertTop; + btnFindNext := TButton.Create(self); + btnFindNext.Text := 'Find Next'; + btnClose := TButton.Create(self); + btnClose.Text := 'Close'; + btnClose.CanExpandWidth := True; + btnClose.OnClick := @btnCloseClick; + rightLayout.InsertChild(btnFindNext); + rightLayout.InsertChild(btnClose); + + mainLayout := TBoxLayout.Create(self); + mainLayout.InsertChild(leftLayout); + mainLayout.InsertChild(rightLayout); + + Child := mainLayout; +end; + +{ +QHBoxLayout *topLeftLayout = new QHBoxLayout; +topLeftLayout->addWidget(label); +topLeftLayout->addWidget(lineEdit); + +QVBoxLayout *leftLayout = new QVBoxLayout; +leftLayout->addLayout(topLeftLayout); +leftLayout->addWidget(buttonGroup); +leftLayout->addWidget(caseCheckBox); + +QVBoxLayout *rightLayout = new QVBoxLayout; +rightLayout->addWidget(findNextButton); +rightLayout->addWidget(closeButton); +rightLayout->addStretch(1); + +QHBoxLayout *mainLayout = new QHBoxLayout(this); +mainLayout->setMargin(11); +mainLayout->setSpacing(6); +mainLayout->addLayout(leftLayout); +mainLayout->addLayout(rightLayout); +} + + +var + GridForm: TGridForm; + FindDialog: TFindDialog; + +{ TGridForm } + +constructor TGridForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + Text := 'Grid Layout'; + BorderWidth := 8; + self.BorderWidth := 11; + + Layout := TGridLayout.Create(Self); + Layout.Name := 'Layout'; + Layout.RowCount := 3; + Layout.ColCount := 3; + + Button1 := TButton.Create(Self); + Button1.Name := 'TopLeft'; + Button1.Text := 'Top Left'; + Layout.AddWidget(Button1, 0, 0, 1, 1); + Button2 := TButton.Create(Self); + Button2.Name := 'TopRight'; + Button2.Text := 'Top Right'; + Layout.AddWidget(Button2, 2,0,1,1); + Button3 := TButton.Create(Self); + Button3.Name := 'CenterCenter'; + Button3.Text := 'Center Center'; + // Button3.CanExpandWidth := False; + // Button3.CanExpandHeight := False; + Layout.AddWidget(Button3, 1,1,1,1); + Button4 := TButton.Create(Self); + Button4.Name := 'BottomLeft'; + Button4.Text := 'Bottom Left'; + Layout.AddWidget(Button4,0,2,1,1); + Button5 := TButton.Create(Self); + Button5.Name := 'BottomRight'; + Button5.Text := 'Bottom Right'; + Layout.AddWidget(Button5, 2,2,1,1); + Child := Layout; +end; + + +{ TMainForm } + +procedure TMainForm.Button3Clicked(Sender: TObject); +begin + Button.SetBounds(100, 50, 100, 45); + Redraw; +end; + +procedure TMainForm.btnCloseClick(Sender: TObject); +begin + Close; +end; + + +procedure TMainForm.btnGridFormClick(Sender: TObject); +begin + if not Assigned(GridForm) then + begin + GridForm := TGridForm.Create(self); +// Application.AddForm(GridForm); + end; + + GridForm.Show; +end; + + +procedure TMainForm.btnCompOptClick(Sender: TObject); +begin + if not Assigned(CompOpt) then + Application.CreateForm(TCompilerOptForm, CompOpt) + else + CompOpt.Show; +end; + + +procedure TMainForm.btnTopClick(Sender: TObject); +begin + if not Assigned(FindDialog) then + FindDialog := TFindDialog.Create(self); + FindDialog.Show; +end; + + +procedure TMainForm.MainFormActivate(Sender: TObject); +var + max: TSize; +begin + max.cx := 600; + max.cy := 400; + self.Wnd.SetMinMaxClientSize(MinSize, max); +end; + + +constructor TMainForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Name := 'frmMain'; + BorderWidth := 8; + WindowType := wtWindow; + OnActivate := @MainFormActivate; + + HBox := TBoxLayout.Create(self); + HBox.Name := 'HBox'; + HBox.Parent := self; + HBox.Spacing := 3; + HBox.Orientation := Horizontal; + + TextLabel := TLabel.Create(self); + TextLabel.Name := 'TextLabel'; + TextLabel.Text := 'Hello'; + TextLabel.Parent := HBox; + + Button := TButton.Create(self); + Button.Parent := HBox; + Button.Text := 'Close'; + Button.OnClick := @btnCloseClick; + + btnGridForm := TButton.Create(self); + btnGridForm.Parent := HBox; + btnGridForm.Text := 'Grid Form'; + btnGridForm.OnClick := @btnGridFormClick; + + btnCompOpt := TButton.Create(Self); + btnCompOpt.Parent := HBox; + btnCompOpt.Name := 'btnCompOpt'; + btnCompOpt.Text := 'Compiler Options'; + btnCompOpt.OnClick := @btnCompOptClick; +// btnCompOpt.FCanExpandWidth := True; // if not used, button is smaller than others + + VBox := TBoxLayout.Create(self); + VBox.Orientation := Vertical; + Button1 := TButton.Create(Self); + Button1.Name := 'Top'; + Button1.Text := 'Top'; + Button1.CanExpandWidth := True; // if not used, button is smaller than others + Button1.OnClick := @btnTopClick; + VBox.InsertChild(Button1); + Button2 := TButton.Create(Self); + Button2.Name := 'Centre'; + Button2.Text := 'Centre'; + Button2.CanExpandWidth := True; + VBox.InsertChild(Button2); + Button3 := TButton.Create(Self); + Button3.Name := 'Bottom'; + Button3.Text := 'Bottom (SetBounds)'; + Button3.OnClick :=@Button3Clicked; + VBox.InsertChild(Button3); + + HBox.InsertChild(VBox); + + + Child := HBox; +end; + + +var + MainForm: TMainForm; + +begin + MainForm := nil; + { set application wide style } + + Application.SetStyle(FOpenSoftStyle); + + MainForm := TMainForm.Create(Application); +// MainForm.SetBounds(Point(100, 300), Size(300,200)); + try + MainForm.Show; + Application.Run; + finally + MainForm.Free; + end; + +end. + diff --git a/examples/gui/dbftest/Makefile b/examples/gui/dbftest/Makefile new file mode 100644 index 00000000..32ad7c72 --- /dev/null +++ b/examples/gui/dbftest/Makefile @@ -0,0 +1,1366 @@ +# +# Makefile generated by fpcmake v1.00 [2001/01/17] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT or OS/2) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +# define inOS2 when running under OS/2 +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +PWD:=$(firstword $(PWD)) +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The extension of batch files / scripts +ifdef inUnix +BATCHEXT=.sh +else +ifdef inOS2 +BATCHEXT=.cmd +else +BATCHEXT=.bat +endif +endif + +# Path Separator, the subst trick is necessary for the \ that can't exists +# at the end of a line +ifdef inUnix +PATHSEP=/ +else +PATHSEP=$(subst /,\,/) +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override EXEOBJECTS+=dbftest + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2h + +# Directories + + +# Packages + +override PACKAGES+=rtl fcl fpgfx fpgui + +# Libraries + + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +PPAS=ppas$(BATCHEXT) + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 +PACKAGEFCL=1 +PACKAGEFPGFX=1 +PACKAGEFPGUI=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef PACKAGEFCL +ifneq ($(wildcard $(FPCDIR)/fcl),) +ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) +PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) +else +PACKAGEDIR_FCL=$(FPCDIR)/fcl +endif +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +UNITDIR_FCL=$(PACKAGEDIR_FCL) +else +PACKAGEDIR_FCL= +ifneq ($(wildcard $(UNITSDIR)/fcl),) +ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) +UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) +else +UNITDIR_FCL=$(UNITSDIR)/fcl +endif +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override NEEDUNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef PACKAGEFPGFX +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx/$(OS_TARGET)),) +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx/$(OS_TARGET) +else +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +else +PACKAGEDIR_FPGFX= +ifneq ($(wildcard $(UNITSDIR)/fpgfx),) +ifneq ($(wildcard $(UNITSDIR)/fpgfx/$(OS_TARGET)),) +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx/$(OS_TARGET) +else +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx +endif +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override NEEDUNITDIR+=$(UNITDIR_FPGFX) +endif +endif +ifdef PACKAGEFPGUI +ifneq ($(wildcard $(PACKAGESDIR)/fpgui),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgui/$(OS_TARGET)),) +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui/$(OS_TARGET) +else +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGUI)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgui +package_fpgui: + $(MAKE) -C $(PACKAGEDIR_FPGUI) all +endif +UNITDIR_FPGUI=$(PACKAGEDIR_FPGUI) +else +PACKAGEDIR_FPGUI= +ifneq ($(wildcard $(UNITSDIR)/fpgui),) +ifneq ($(wildcard $(UNITSDIR)/fpgui/$(OS_TARGET)),) +UNITDIR_FPGUI=$(UNITSDIR)/fpgui/$(OS_TARGET) +else +UNITDIR_FPGUI=$(UNITSDIR)/fpgui +endif +else +UNITDIR_FPGUI= +endif +endif +ifdef UNITDIR_FPGUI +override NEEDUNITDIR+=$(UNITDIR_FPGUI) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Exes +##################################################################### + +.PHONY: fpc_exes + +ifdef EXEOBJECTS +override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) + +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) + +endif + +fpc_exes: $(EXEFILES) + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +PACKAGESUFFIX=emx +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +# Use a wrapper script by default for OS/2 +ifdef inOS2 +USEZIPWRAPPER=1 +endif + +# Create commands to create the zip/tar file +ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) +ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USETAR +ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * +else +ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(DEL) $(ZIPDESTFILE) +ifdef USEZIPWRAPPER +ifneq ($(ECHO),echo) + $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) + $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) + $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +else + $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) +endif +ifdef inUnix + /bin/sh $(ZIPWRAPPER) +else + $(ZIPWRAPPER) +endif + $(DEL) $(ZIPWRAPPER) +else + $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/examples/gui/dbftest/Makefile.fpc b/examples/gui/dbftest/Makefile.fpc new file mode 100644 index 00000000..c3024e8b --- /dev/null +++ b/examples/gui/dbftest/Makefile.fpc @@ -0,0 +1,10 @@ +# +# Makefile.fpc for fpGUI DBFTest example +# + +[targets] +programs=dbftest + +[require] +options=-S2h +packages=fcl fpgfx fpgui diff --git a/examples/gui/dbftest/dbftest.pas b/examples/gui/dbftest/dbftest.pas new file mode 100644 index 00000000..32c70484 --- /dev/null +++ b/examples/gui/dbftest/dbftest.pas @@ -0,0 +1,114 @@ +{ + $Id: dbftest.pp,v 1.2 2001/01/18 12:40:41 sg Exp $ + + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2001 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + + DBF database test + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + 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. +} + + +program DBFTest; + +uses SysUtils, Classes, fpGUI, fpGUI_DB, DB, DBF; + +type + + TMainForm = class(TForm) + DataSet: TDBF; + DataSource: TDataSource; + Box: TBoxLayout; + ListBox: TListBox; + CurDatasetLabel: TLabel; + CurNameText, CurEMailText: TDBText; + Navi: TBoxLayout; + FirstDataset, PrevDataset, NextDataset, LastDataset: TButton; + procedure FormCreate(Sender: TObject); + procedure FirstDatasetClick(Sender: TObject); + procedure PrevDatasetClick(Sender: TObject); + procedure NextDatasetClick(Sender: TObject); + procedure LastDatasetClick(Sender: TObject); + end; + + +// ------------------------------------------------------------------- +// TMainForm +// ------------------------------------------------------------------- + +procedure TMainForm.FormCreate(Sender: TObject); +var + x: Integer; + s: String; +begin + DataSet := TDBF.Create(Self); + DataSet.TableName := 'test.dbf'; + DataSource := TDataSource.Create(Self); + DataSource.DataSet := DataSet; + + CurNameText.DataSource := DataSource; + CurNameText.DataField := 'Name'; + CurEMailText.DataSource := DataSource; + CurEMailText.DataField := 'Address'; + + DataSet.Open; + + while not DataSet.EOF do + begin + SetLength(s, 0); + for x := 0 to DataSet.FieldCount - 2 do + s := s + DataSet.Fields[x].AsString + ', '; + s := s + DataSet.Fields[DataSet.FieldCount - 1].AsString; + ListBox.Items.Add(s); + DataSet.Next; + end; + + DataSet.First; +end; + +procedure TMainForm.FirstDatasetClick(Sender: TObject); +begin + DataSet.First; +end; + +procedure TMainForm.PrevDatasetClick(Sender: TObject); +begin + DataSet.Prior; +end; + +procedure TMainForm.NextDatasetClick(Sender: TObject); +begin + DataSet.Next; +end; + +procedure TMainForm.LastDatasetClick(Sender: TObject); +begin + DataSet.Last; +end; + + +var + MainForm: TMainForm; +begin + Application.Title := 'Interbase Test'; + Application.CreateForm(TMainForm, MainForm); + Application.Run; +end. + + +{ + $Log: dbftest.pp,v $ + Revision 1.2 2001/01/18 12:40:41 sg + * Now uses the correct field names for the data links ;) + + Revision 1.1 2001/01/17 21:33:28 sg + * First version + +} diff --git a/examples/gui/dbftest/mainform.frm b/examples/gui/dbftest/mainform.frm new file mode 100644 index 00000000..9508c21e --- /dev/null +++ b/examples/gui/dbftest/mainform.frm @@ -0,0 +1,38 @@ +object MainForm: TMainForm + Text = 'DBF test' + BorderWidth = 8 + OnCreate = FormCreate + object Box: TBoxLayout + Spacing = 8 + Orientation = Vertical + object ListBox: TListBox + end + object CurDatasetLabel: TLabel + Text = 'Current dataset:' + end + object CurNameText: TDBText + Text = '<name>' + end + object CurEMailText: TDBText + Text = '<e-mail>' + end + object Navi: TBoxLayout + object FirstDataset: TButton + Text = 'First' + OnClick = FirstDatasetClick + end + object PrevDataset: TButton + Text = 'Previous' + OnClick = PrevDatasetClick + end + object NextDataset: TButton + Text = 'Next' + OnClick = NextDatasetClick + end + object LastDataset: TButton + Text = 'Last' + OnClick = LastDatasetClick + end + end + end +end diff --git a/examples/gui/dbftest/test.dbf b/examples/gui/dbftest/test.dbf Binary files differnew file mode 100644 index 00000000..cebd1384 --- /dev/null +++ b/examples/gui/dbftest/test.dbf diff --git a/examples/gui/helloworld/Makefile b/examples/gui/helloworld/Makefile new file mode 100644 index 00000000..c2e4e873 --- /dev/null +++ b/examples/gui/helloworld/Makefile @@ -0,0 +1,1320 @@ +# +# Makefile generated by fpcmake v1.00 [2000/12/14] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION FPCOPT + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override EXEOBJECTS+=helloworld + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2h + +# Directories + + +# Packages + +override PACKAGES+=rtl fcl fpgfx fpgui + +# Libraries + + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +ifdef inUnix +PPAS=ppas.sh +else +ifdef inOS2 +PPAS=ppas.cmd +else +PPAS=ppas.bat +endif +endif + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 +PACKAGEFCL=1 +PACKAGEFPGFX=1 +PACKAGEFPGUI=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef PACKAGEFCL +ifneq ($(wildcard $(FPCDIR)/fcl),) +ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) +PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) +else +PACKAGEDIR_FCL=$(FPCDIR)/fcl +endif +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +UNITDIR_FCL=$(PACKAGEDIR_FCL) +else +PACKAGEDIR_FCL= +ifneq ($(wildcard $(UNITSDIR)/fcl),) +ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) +UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) +else +UNITDIR_FCL=$(UNITSDIR)/fcl +endif +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override NEEDUNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef PACKAGEFPGFX +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx/$(OS_TARGET)),) +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx/$(OS_TARGET) +else +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +else +PACKAGEDIR_FPGFX= +ifneq ($(wildcard $(UNITSDIR)/fpgfx),) +ifneq ($(wildcard $(UNITSDIR)/fpgfx/$(OS_TARGET)),) +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx/$(OS_TARGET) +else +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx +endif +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override NEEDUNITDIR+=$(UNITDIR_FPGFX) +endif +endif +ifdef PACKAGEFPGUI +ifneq ($(wildcard $(PACKAGESDIR)/fpgui),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgui/$(OS_TARGET)),) +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui/$(OS_TARGET) +else +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGUI)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgui +package_fpgui: + $(MAKE) -C $(PACKAGEDIR_FPGUI) all +endif +UNITDIR_FPGUI=$(PACKAGEDIR_FPGUI) +else +PACKAGEDIR_FPGUI= +ifneq ($(wildcard $(UNITSDIR)/fpgui),) +ifneq ($(wildcard $(UNITSDIR)/fpgui/$(OS_TARGET)),) +UNITDIR_FPGUI=$(UNITSDIR)/fpgui/$(OS_TARGET) +else +UNITDIR_FPGUI=$(UNITSDIR)/fpgui +endif +else +UNITDIR_FPGUI= +endif +endif +ifdef UNITDIR_FPGUI +override NEEDUNITDIR+=$(UNITDIR_FPGUI) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Exes +##################################################################### + +.PHONY: fpc_exes + +ifdef EXEOBJECTS +override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) + +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) + +endif + +fpc_exes: $(EXEFILES) + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) +ifdef USETAR + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) + cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR) +else + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) + cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/examples/gui/helloworld/Makefile.fpc b/examples/gui/helloworld/Makefile.fpc new file mode 100644 index 00000000..03d81490 --- /dev/null +++ b/examples/gui/helloworld/Makefile.fpc @@ -0,0 +1,10 @@ +# +# Makefile.fpc for fpGUI HelloWorld example +# + +[targets] +programs=helloworld + +[require] +options=-S2h +packages=fcl fpgfx fpgui diff --git a/examples/gui/helloworld/helloworld.lpi b/examples/gui/helloworld/helloworld.lpi new file mode 100644 index 00000000..f9e413e9 --- /dev/null +++ b/examples/gui/helloworld/helloworld.lpi @@ -0,0 +1,57 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + </General> + <PublishOptions> + <Version Value="2"/> + <IgnoreBinaries Value="False"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpGUI_laz"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="helloworld.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="HelloWorld"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <SearchPaths> + <OtherUnitFiles Value="../../src/"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <AllowLabel Value="False"/> + </SyntaxOptions> + </Parsing> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/gui/helloworld/helloworld.pas b/examples/gui/helloworld/helloworld.pas new file mode 100644 index 00000000..8151291a --- /dev/null +++ b/examples/gui/helloworld/helloworld.pas @@ -0,0 +1,22 @@ +program HelloWorld; + +{$mode objfpc}{$h+} + +uses + fpGUI, fpGUI_laz; + +type + TMainForm = class(TForm) + TextLabel: TLabel; + lblClose: TLabel; + end; + +var + MainForm: TMainForm; + +begin + Application.CreateForm(TMainForm, MainForm); + + Application.Run; + MainForm.Free; +end. diff --git a/examples/gui/helloworld/mainform.frm b/examples/gui/helloworld/mainform.frm new file mode 100644 index 00000000..f7bc0544 --- /dev/null +++ b/examples/gui/helloworld/mainform.frm @@ -0,0 +1,11 @@ +object MainWindow: TMainWindow
+ BorderWidth = 8
+ WindowOptions = [woWindow]
+ object TextLabel: TLabel
+ Text = 'Hello, world!'
+ end
+ object lblClose: TLabel
+ Text = '&Close'
+ end
+end
+
diff --git a/examples/gui/interbasetest/Makefile b/examples/gui/interbasetest/Makefile new file mode 100644 index 00000000..94d80579 --- /dev/null +++ b/examples/gui/interbasetest/Makefile @@ -0,0 +1,1320 @@ +# +# Makefile generated by fpcmake v1.00 [2000/12/14] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION FPCOPT + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override EXEOBJECTS+=interbasetest + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2h + +# Directories + + +# Packages + +override PACKAGES+=rtl fcl fpgfx fpgui + +# Libraries + + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +ifdef inUnix +PPAS=ppas.sh +else +ifdef inOS2 +PPAS=ppas.cmd +else +PPAS=ppas.bat +endif +endif + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 +PACKAGEFCL=1 +PACKAGEFPGFX=1 +PACKAGEFPGUI=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef PACKAGEFCL +ifneq ($(wildcard $(FPCDIR)/fcl),) +ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) +PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) +else +PACKAGEDIR_FCL=$(FPCDIR)/fcl +endif +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +UNITDIR_FCL=$(PACKAGEDIR_FCL) +else +PACKAGEDIR_FCL= +ifneq ($(wildcard $(UNITSDIR)/fcl),) +ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) +UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) +else +UNITDIR_FCL=$(UNITSDIR)/fcl +endif +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override NEEDUNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef PACKAGEFPGFX +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx/$(OS_TARGET)),) +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx/$(OS_TARGET) +else +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +else +PACKAGEDIR_FPGFX= +ifneq ($(wildcard $(UNITSDIR)/fpgfx),) +ifneq ($(wildcard $(UNITSDIR)/fpgfx/$(OS_TARGET)),) +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx/$(OS_TARGET) +else +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx +endif +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override NEEDUNITDIR+=$(UNITDIR_FPGFX) +endif +endif +ifdef PACKAGEFPGUI +ifneq ($(wildcard $(PACKAGESDIR)/fpgui),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgui/$(OS_TARGET)),) +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui/$(OS_TARGET) +else +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGUI)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgui +package_fpgui: + $(MAKE) -C $(PACKAGEDIR_FPGUI) all +endif +UNITDIR_FPGUI=$(PACKAGEDIR_FPGUI) +else +PACKAGEDIR_FPGUI= +ifneq ($(wildcard $(UNITSDIR)/fpgui),) +ifneq ($(wildcard $(UNITSDIR)/fpgui/$(OS_TARGET)),) +UNITDIR_FPGUI=$(UNITSDIR)/fpgui/$(OS_TARGET) +else +UNITDIR_FPGUI=$(UNITSDIR)/fpgui +endif +else +UNITDIR_FPGUI= +endif +endif +ifdef UNITDIR_FPGUI +override NEEDUNITDIR+=$(UNITDIR_FPGUI) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Exes +##################################################################### + +.PHONY: fpc_exes + +ifdef EXEOBJECTS +override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) + +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) + +endif + +fpc_exes: $(EXEFILES) + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) +ifdef USETAR + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) + cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR) +else + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) + cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/examples/gui/interbasetest/Makefile.fpc b/examples/gui/interbasetest/Makefile.fpc new file mode 100644 index 00000000..7d8d31ff --- /dev/null +++ b/examples/gui/interbasetest/Makefile.fpc @@ -0,0 +1,10 @@ +# +# Makefile.fpc for fpGUI InterbaseTest example +# + +[targets] +programs=interbasetest + +[require] +options=-S2h +packages=fcl fpgfx fpgui diff --git a/examples/gui/interbasetest/interbasetest.pas b/examples/gui/interbasetest/interbasetest.pas new file mode 100644 index 00000000..18f67c83 --- /dev/null +++ b/examples/gui/interbasetest/interbasetest.pas @@ -0,0 +1,131 @@ +{ + $Id: interbasetest.pp,v 1.2 2001/01/17 21:35:45 sg Exp $ + + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2001 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + + InterBase database test + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + 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. +} + + +program InterBaseTest; + +{$linklib dl} +{$linklib crypt} + +uses SysUtils, Classes, fpGUI, fpGUI_DB, DB, InterBase; + +type + + TMainForm = class(TForm) + Database: TIBDatabase; + Transaction: TIBTransaction; + Query: TIBQuery; + DataSource: TDataSource; + Box, ConnectionBox: TBoxLayout; + ConnectionLabel, ConnectionStateLabel: TLabel; + ListBox: TListBox; + CurDatasetLabel: TLabel; + CurNameText, CurEMailText: TDBText; + Navi: TBoxLayout; + FirstDataset, PrevDataset, NextDataset, LastDataset: TButton; + procedure FormCreate(Sender: TObject); + procedure FirstDatasetClick(Sender: TObject); + procedure PrevDatasetClick(Sender: TObject); + procedure NextDatasetClick(Sender: TObject); + procedure LastDatasetClick(Sender: TObject); + end; + + +// ------------------------------------------------------------------- +// TMainForm +// ------------------------------------------------------------------- + +procedure TMainForm.FormCreate(Sender: TObject); +var + x: Integer; + s: String; +begin + Query := TIBQuery.Create(Self); + + Database.Connected := True; + Database.Transaction := Transaction; + Query.Database := Database; + DataSource.DataSet := Query; + Transaction.Action := caRollback; + Transaction.Active := True; + + if Database.Connected then + ConnectionStateLabel.Text := 'Yes' + else + ConnectionStateLabel.Text := 'No'; + + CurNameText.DataSource := DataSource; + CurNameText.DataField := 'UserName'; + CurEMailText.DataSource := DataSource; + CurEMailText.DataField := 'InstEmail'; + + Query.SQL.Add('select * from fpdev'); +WriteLn('Query.Active? ', Query.Active); + Query.Open; + +WriteLn('Query.Active? ', Query.Active); + + while not Query.EOF do + begin + SetLength(s, 0); + for x := 0 to Query.FieldCount - 2 do + s := s + Query.Fields[x].AsString + ', '; + s := s + Query.Fields[Query.FieldCount - 1].AsString; + ListBox.Items.Add(s); + Query.Next; + end; + + Query.First; +end; + +procedure TMainForm.FirstDatasetClick(Sender: TObject); +begin + Query.First; +end; + +procedure TMainForm.PrevDatasetClick(Sender: TObject); +begin + Query.Prior; +end; + +procedure TMainForm.NextDatasetClick(Sender: TObject); +begin + Query.Next; +end; + +procedure TMainForm.LastDatasetClick(Sender: TObject); +begin + Query.Last; +end; + + + +var + MainForm: TMainForm; +begin + Application.Title := 'InterBase Test'; + Application.CreateForm(TMainForm, MainForm); + Application.Run; +end. + + +{ + $Log: interbasetest.pp,v $ + Revision 1.2 2001/01/17 21:35:45 sg + * Now uses fpGUI_DB unit + +} diff --git a/examples/gui/interbasetest/mainform.frm b/examples/gui/interbasetest/mainform.frm new file mode 100644 index 00000000..354c5b6e --- /dev/null +++ b/examples/gui/interbasetest/mainform.frm @@ -0,0 +1,55 @@ +object MainForm: TMainForm + Text = 'Interbase test' + BorderWidth = 8 + OnCreate = FormCreate + object Database: TIBDatabase + DatabaseName = 'test.gdb' + UserName = 'sysdba' + Password = 'masterkey' + end + object Transaction: TIBTransaction + end + object DataSource: TDataSource + end + object Box: TBoxLayout + Spacing = 8 + Orientation = Vertical + object ConnectionBox: TBoxLayout + object ConnectionLabel: TLabel + Text = 'Connected to database? ' + end + object ConnectionStateLabel: TLabel + Text = 'unknown' + end + end + object ListBox: TListBox + end + object CurDatasetLabel: TLabel + Text = 'Current dataset:' + end + object CurNameText: TDBText + Text = '<name>' + end + object CurEMailText: TDBText + Text = '<e-mail>' + end + object Navi: TBoxLayout + object FirstDataset: TButton + Text = 'First' + OnClick = FirstDatasetClick + end + object PrevDataset: TButton + Text = 'Previous' + OnClick = PrevDatasetClick + end + object NextDataset: TButton + Text = 'Next' + OnClick = NextDatasetClick + end + object LastDataset: TButton + Text = 'Last' + OnClick = LastDatasetClick + end + end + end +end diff --git a/examples/gui/interbasetest/mkdb b/examples/gui/interbasetest/mkdb new file mode 100644 index 00000000..b4142314 --- /dev/null +++ b/examples/gui/interbasetest/mkdb @@ -0,0 +1,53 @@ +#!/bin/sh +# +# Script to create a table 'FPdev' and to fill it with data. +# The script accepts an optional argument : +# A database to connect to. (default 'testdb') +# +# Collect the database +DATABASE=test.gdb +# Choose one of the following: +# ISQL=isql +ISQL=/opt/interbase/bin/isql +# +# Don't edit after this. +# +echo -n "Creating and filling table FPdev in database $DATABASE..." +# >/dev/null 2>&1 +${ISQL} << EOF +set sql dialect 3; +CREATE DATABASE "$DATABASE"; +create table FPDEV ( +id INT NOT NULL, +UserName varchar(50), +InstEmail CHAR(50), +PRIMARY KEY (id)); +insert into FPdev values ('1','Michael Van Canneyt','Michael@tfdec1.fys.kuleuven.ac.be'); +insert into FPdev values ('2','Florian Klaempfl','ba2395@fen.baynet.de'); +insert into FPdev values ('3','Carl-Eric Codere','codc01@gel.usherb.ca'); +insert into FPdev values ('4','Daniel Mantione','d.s.p.mantione@twi.tudelft.nl'); +insert into FPdev values ('5','Pierre Muller','muller@europe.u-strasbg.fr'); +insert into FPdev values ('6','Jonas Maebe','jmaebe@mail.dma.be'); +insert into FPdev values ('7','Peter Vreman','pfv@worldonline.nl'); +insert into FPdev values ('8','Gerry Dubois','gerry@webworks.ml.org'); +insert into FPdev values ('9','name9','mail9'); +insert into FPdev values ('10','name10','mail10'); +insert into FPdev values ('11','name11','mail11'); +insert into FPdev values ('12','name12','mail12'); +create table test ( +timestamp_fld timestamp, +smallint_fld smallint, +integer_fld integer, +float_fld float, +double_fld double precision, +char_fld char(10), +varchar_fld varchar(50)); +insert into test values ('12.1.2000 00:30',10,70000,12.5,20.5,'testchar','testvarchar'); +commit; +EOF +if [ ! $? = 0 ]; then + echo "Failed." +else + echo "Done." +fi +# Ready diff --git a/examples/gui/layouttest/Makefile b/examples/gui/layouttest/Makefile new file mode 100644 index 00000000..2ccf237e --- /dev/null +++ b/examples/gui/layouttest/Makefile @@ -0,0 +1,1320 @@ +# +# Makefile generated by fpcmake v1.00 [2000/12/14] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION FPCOPT + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override EXEOBJECTS+=layouttest + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2h + +# Directories + + +# Packages + +override PACKAGES+=rtl fcl fpgfx fpgui + +# Libraries + + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +ifdef inUnix +PPAS=ppas.sh +else +ifdef inOS2 +PPAS=ppas.cmd +else +PPAS=ppas.bat +endif +endif + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 +PACKAGEFCL=1 +PACKAGEFPGFX=1 +PACKAGEFPGUI=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef PACKAGEFCL +ifneq ($(wildcard $(FPCDIR)/fcl),) +ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) +PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) +else +PACKAGEDIR_FCL=$(FPCDIR)/fcl +endif +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +UNITDIR_FCL=$(PACKAGEDIR_FCL) +else +PACKAGEDIR_FCL= +ifneq ($(wildcard $(UNITSDIR)/fcl),) +ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) +UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) +else +UNITDIR_FCL=$(UNITSDIR)/fcl +endif +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override NEEDUNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef PACKAGEFPGFX +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx/$(OS_TARGET)),) +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx/$(OS_TARGET) +else +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +else +PACKAGEDIR_FPGFX= +ifneq ($(wildcard $(UNITSDIR)/fpgfx),) +ifneq ($(wildcard $(UNITSDIR)/fpgfx/$(OS_TARGET)),) +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx/$(OS_TARGET) +else +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx +endif +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override NEEDUNITDIR+=$(UNITDIR_FPGFX) +endif +endif +ifdef PACKAGEFPGUI +ifneq ($(wildcard $(PACKAGESDIR)/fpgui),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgui/$(OS_TARGET)),) +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui/$(OS_TARGET) +else +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGUI)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgui +package_fpgui: + $(MAKE) -C $(PACKAGEDIR_FPGUI) all +endif +UNITDIR_FPGUI=$(PACKAGEDIR_FPGUI) +else +PACKAGEDIR_FPGUI= +ifneq ($(wildcard $(UNITSDIR)/fpgui),) +ifneq ($(wildcard $(UNITSDIR)/fpgui/$(OS_TARGET)),) +UNITDIR_FPGUI=$(UNITSDIR)/fpgui/$(OS_TARGET) +else +UNITDIR_FPGUI=$(UNITSDIR)/fpgui +endif +else +UNITDIR_FPGUI= +endif +endif +ifdef UNITDIR_FPGUI +override NEEDUNITDIR+=$(UNITDIR_FPGUI) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Exes +##################################################################### + +.PHONY: fpc_exes + +ifdef EXEOBJECTS +override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) + +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) + +endif + +fpc_exes: $(EXEFILES) + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) +ifdef USETAR + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) + cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR) +else + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) + cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/examples/gui/layouttest/Makefile.fpc b/examples/gui/layouttest/Makefile.fpc new file mode 100644 index 00000000..f779ccca --- /dev/null +++ b/examples/gui/layouttest/Makefile.fpc @@ -0,0 +1,10 @@ +# +# Makefile.fpc for fpGUI LayoutTest example +# + +[targets] +programs=layouttest + +[require] +options=-S2h +packages=fcl fpgfx fpgui diff --git a/examples/gui/layouttest/boxform.frm b/examples/gui/layouttest/boxform.frm new file mode 100644 index 00000000..2e03f217 --- /dev/null +++ b/examples/gui/layouttest/boxform.frm @@ -0,0 +1,24 @@ +object BoxWindow: TBoxWindow + Text = 'Box layout' + BorderWidth = 8 + object Layout: TBoxLayout + Spacing = 8 + Orientation = Vertical + object BoxLayout: TBoxLayout + Spacing = 4 + object Button1: TButton + Text = 'Button 1' + end + object Button2: TButton + Text = 'Button 2' + end + object Button3: TButton + Text = 'Button 3' + end + end + object FlipButton: TButton + Text = 'Switch to vertical' + OnClick = FlipOrientation + end + end +end diff --git a/examples/gui/layouttest/layouttest.lpi b/examples/gui/layouttest/layouttest.lpi new file mode 100644 index 00000000..2f6d428d --- /dev/null +++ b/examples/gui/layouttest/layouttest.lpi @@ -0,0 +1,63 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + </General> + <PublishOptions> + <Version Value="2"/> + <IgnoreBinaries Value="False"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="LCL"/> + <MinVersion Major="1" Valid="True"/> + </Item1> + <Item2> + <PackageName Value="fpGUI_laz"/> + </Item2> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="layouttest.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="LayoutTest"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <SearchPaths> + <SrcPath Value="../../src/"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <AllowLabel Value="False"/> + </SyntaxOptions> + </Parsing> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits +"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/gui/layouttest/layouttest.pas b/examples/gui/layouttest/layouttest.pas new file mode 100644 index 00000000..6cf90662 --- /dev/null +++ b/examples/gui/layouttest/layouttest.pas @@ -0,0 +1,294 @@ +program LayoutTest; + +uses Classes, fpGUI; + +type + TDockingForm = class; + TGridForm = class; + TBoxForm = class; + TSimpleForm = class; + + { TMainForm } + + TMainForm = class(TForm) + private + DockingForm: TDockingForm; + GridForm: TGridForm; + BoxForm: TBoxForm; + SimpleForm: TSimpleForm; + public + destructor Destroy; override; + published + Box: TBoxLayout; + Title: TLabel; + SimpleBtn, FixedBtn, BoxBtn, GridBtn, DockingBtn, ExitBtn: TButton; + //Separator: TSeparator; + procedure SimpleBtnClicked(Sender: TObject); + procedure FixedBtnClicked(Sender: TObject); + procedure DockingBtnClicked(Sender: TObject); + procedure GridBtnClicked(Sender: TObject); + procedure BoxBtnClicked(Sender: TObject); + procedure ExitBtnClicked(Sender: TObject); + end; + + TSimpleForm = class(TForm) + Button: TButton; + public + constructor Create(AOwner: TComponent); override; + end; + +{ TFixedForm = class(TForm) + Layout: TFixedLayout; + Button1, Button2: TButton; + public + constructor Create(AOwner: TComponent); override; + end; } + + TDockingForm = Class(TForm) + Layout : TDockingLayout; + Button1,Button2,Button3,Button4,Button5 : TButton; + public + constructor Create(AOwner: TComponent); override; + end; + + + TGridForm = Class(TForm) + Layout : TGridLayout; + Button1,Button2,Button3,Button4,Button5, Button6 : TButton; + public + constructor Create(AOwner: TComponent); override; + end; + + TBoxForm = Class(TForm) + Layout, BoxLayout: TBoxLayout; + Button1, Button2, Button3, FlipButton: TButton; + procedure FlipOrientation(Sender: TObject); + end; + + +// ------------------------------------------------------------------- +// TMainForm +// ------------------------------------------------------------------- + +destructor TMainForm.Destroy; +begin + GridForm.Free; + BoxForm.Free; + DockingForm.Free; + SimpleForm.Free; + inherited Destroy; +end; + + +procedure TMainForm.SimpleBtnClicked(Sender: TObject); +begin + if not Assigned(SimpleForm) then + SimpleForm := TSimpleForm.Create(self); + SimpleForm.Show; +end; + + +procedure TMainForm.FixedBtnClicked(Sender: TObject); +begin +// Application.AddForm(TFixedForm.Create(Application)); +end; + + +procedure TMainForm.DockingBtnClicked(Sender: TObject); +begin + Exit; //==> + +{ if not Assigned(DockingForm) then + DockingForm := TDockingForm.Create(self); + DockingForm.Show; +} + Application.AddForm(TDockingForm.Create(self)); +end; + + +procedure TMainForm.GridBtnClicked(Sender: TObject); +var + f, f2: TStream; +begin + if not Assigned(GridForm) then + GridForm := TGridForm.Create(self); + GridForm.Show; + { Output the structure of GridForm.Layout } + f := TMemoryStream.Create; + f.WriteComponent(GridForm.Layout); + f2 := THandleStream.Create(StdOutputHandle); + f.Position := 0; + ObjectBinaryToText(f, f2); + f2.Free; + f.Free; +end; + + +procedure TMainForm.BoxBtnClicked(Sender: TObject); +begin + if not Assigned(BoxForm) then + Application.CreateForm(TBoxForm, BoxForm); + BoxForm.Show; +end; + + +procedure TMainForm.ExitBtnClicked(Sender: TObject); +begin + Close; +end; + + +// ------------------------------------------------------------------- +// TSimpleForm +// ------------------------------------------------------------------- + +constructor TSimpleForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + Text := 'Simple Layout'; + BorderWidth := 8; + + Button := TButton.Create(Self); + Button.Text := 'A button...'; + Child := Button; +end; + + +// ------------------------------------------------------------------- +// TFixedForm +// ------------------------------------------------------------------- +{ +constructor TFixedForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + Text := 'Fixed Layout'; + BorderWidth := 8; + + Layout := TFixedLayout.Create(Self); + Layout.Name := 'Layout'; + Button1 := TButton.Create(Self); + Button1.Name := 'Button1'; + Button1.Text := 'A button'; + Layout.AddControl(Button1, 20, 20); + Button2 := TButton.Create(Self); + Button2.Name := 'Button2'; + Button2.Text := 'Another button'; + Layout.AddControl(Button2, 50, 100); + Child := Layout; +end; + +} +// ------------------------------------------------------------------- +// TDockingForm +// ------------------------------------------------------------------- + + +constructor TDockingForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + Text := 'Docking Layout'; + BorderWidth := 8; + + Layout := TDockingLayout.Create(Self); + Layout.Name := 'Layout'; + Button1 := TButton.Create(Self); + Button1.Name := 'BTop'; + Button1.Text := 'Top Alignment'; + Layout.AddWidget(Button1, dmTop); + Button2 := TButton.Create(Self); + Button2.Name := 'BBottom'; + Button2.Text := 'Bottom Alignment'; + Layout.AddWidget(Button2, dmBottom); + Button3 := TButton.Create(Self); + Button3.Name := 'BLeft'; + Button3.Text := 'Left Alignment'; + Layout.AddWidget(Button3, dmLeft); + Button4 := TButton.Create(Self); + Button4.Name := 'BRight'; + Button4.Text := 'Right Alignment'; + Layout.AddWidget(Button4, dmRight); + Button5 := TButton.Create(Self); + Button5.Name := 'BCLient'; + Button5.Text := 'Client Alignment'; + Layout.AddWidget(Button5, dmClient); + Child := Layout; +end; + + +// ------------------------------------------------------------------- +// TGridForm +// ------------------------------------------------------------------- + +constructor TGridForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + Text := 'Grid Layout'; + BorderWidth := 8; + + Layout := TGridLayout.Create(Self); + Layout.Name := 'Layout'; + Layout.RowCount := 4; + Layout.ColCount := 3; + + Button1 := TButton.Create(Self); + Button1.Name := 'TopLeft'; + Button1.Text := 'Top Left'; + Layout.AddWidget(Button1, 0, 0, 1, 1); + Button2 := TButton.Create(Self); + Button2.Name := 'TopRight'; + Button2.Text := 'Top Right'; + Layout.AddWidget(Button2, 2,0,1,1); + Button3 := TButton.Create(Self); + Button3.Name := 'CenterCenter'; + Button3.Text := 'Center Center'; + // Button3.CanExpandWidth := False; + // Button3.CanExpandHeight := False; + Layout.AddWidget(Button3, 1,1,1,1); + Button4 := TButton.Create(Self); + Button4.Name := 'BottomLeft'; + Button4.Text := 'Bottom Left'; + Layout.AddWidget(Button4,0,2,1,1); + Button5 := TButton.Create(Self); + Button5.Name := 'BottomRight'; + Button5.Text := 'Bottom Right'; + Layout.AddWidget(Button5, 2,2,1,1); + Button6 := TButton.Create(Self); + Button6.Name := 'BottomSpan'; + Button6.Text := 'Span Columns'; + Layout.AddWidget(Button6, 0,3,3,1); + Child := Layout; +end; + + +// ------------------------------------------------------------------- +// TBoxForm +// ------------------------------------------------------------------- + +procedure TBoxForm.FlipOrientation (Sender : TObject); +begin + with BoxLayout do + if Orientation = Horizontal then + begin + Orientation := Vertical; + FlipButton.Text:='Switch to horizontal'; + end + else + begin + Orientation := Horizontal; + FlipButton.text:='Switch to vertical'; + end; +end; + + +var + MainForm: TMainForm; +begin + MainForm := nil; + Application.CreateForm(TMainForm, MainForm); + Application.Run; + MainForm.Free; +end. diff --git a/examples/gui/layouttest/mainform.frm b/examples/gui/layouttest/mainform.frm new file mode 100644 index 00000000..ecad852b --- /dev/null +++ b/examples/gui/layouttest/mainform.frm @@ -0,0 +1,33 @@ +object MainWindow: TMainWindow + BorderWidth = 8 + object Box: TBoxLayout + Spacing = 8 + Orientation = Vertical + object Label: TLabel + Text = 'Choose a test Window:' + end + object SimpleBtn: TButton + Text = 'Simple layout' + OnClick = SimpleBtnClicked + end + object FixedBtn: TButton + Text = 'Fixed layout' + end + object BoxBtn: TButton + Text = 'Box layout' + OnClick = BoxBtnClicked + end + object GridBtn: TButton + Text = 'Grid layout' + OnClick = GridBtnClicked + end + object DockingBtn: TButton + Text = 'Docking layout' + OnClick = DockingBtnClicked + end + object ExitBtn: TButton + Text = 'Exit' + OnClick = ExitBtnClicked + end + end +end diff --git a/examples/gui/layouttest/simpleform.frm b/examples/gui/layouttest/simpleform.frm new file mode 100644 index 00000000..390106f0 --- /dev/null +++ b/examples/gui/layouttest/simpleform.frm @@ -0,0 +1,7 @@ +object SimpleWindow: TSimpleWindow + Text = 'Simple layout' + BorderWidth = 8 + object Button: TButton + Text = 'A button...' + end +end diff --git a/examples/gui/utfdemo/test.pas b/examples/gui/utfdemo/test.pas new file mode 100644 index 00000000..6c551cb1 --- /dev/null +++ b/examples/gui/utfdemo/test.pas @@ -0,0 +1,4 @@ +â•”â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•• +â• â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•¡ +â•‘ │ +â•šâ•â•â•â•â•â•â•â•â•â•â•â•â•â•â•› diff --git a/examples/gui/utfdemo/utfdemo.lpi b/examples/gui/utfdemo/utfdemo.lpi new file mode 100644 index 00000000..aa97adce --- /dev/null +++ b/examples/gui/utfdemo/utfdemo.lpi @@ -0,0 +1,49 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=".exe"/> + </General> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpGUI_laz"/> + <MinVersion Minor="3" Valid="True"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="utfdemo.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="utfdemo"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/gui/utfdemo/utfdemo.lpr b/examples/gui/utfdemo/utfdemo.lpr new file mode 100644 index 00000000..3d047bec --- /dev/null +++ b/examples/gui/utfdemo/utfdemo.lpr @@ -0,0 +1,71 @@ +program utfdemo; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, + gfxbase, + fpgui, fpGUI_laz; + +type + + { TMainForm } + + TMainForm = class(TForm) + private + FLayout: TBoxLayout; + procedure MainFormActivate(Sender: TObject); + public + constructor Create(AOwner: TComponent); override; + published + TextLabel: TLabel; + end; + + +{ TMainForm } + +procedure TMainForm.MainFormActivate(Sender: TObject); +var + max: TSize; +begin + max.cx := 320; + max.cy := 200; + Wnd.SetMinMaxClientSize(MinSize, max); +end; + + +constructor TMainForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Name := 'frmMain'; + BorderWidth := 8; +// WindowType := wtWindow; + Text := 'UTF Demo'; + OnActivate := @MainFormActivate; + + FLayout := TBoxLayout.Create(self); + FLayout.Parent := self; + InsertChild(FLayout); + + TextLabel := TLabel.Create(self); + TextLabel.Text := '&Gráficas Magnificacion! Teste'; + FLayout.InsertChild(TextLabel); +end; + + +var + MainForm: TMainForm; +begin + MainForm := TMainForm.Create(Application); + try + MainForm.Show; + Application.Run; + finally + MainForm.Free; + end; +end. + + diff --git a/examples/gui/widgetdemo/OpenSoftStyle.pas b/examples/gui/widgetdemo/OpenSoftStyle.pas new file mode 100644 index 00000000..d0bb2b12 --- /dev/null +++ b/examples/gui/widgetdemo/OpenSoftStyle.pas @@ -0,0 +1,137 @@ +unit OpenSoftStyle; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, fpgui, gfxbase; + +type + + { TOpenSoftStyle } + + TOpenSoftStyle = class(TDefaultStyle) + public + // Colors + function GetGUIColor(Color: TColor): TGfxColor; override; + // Buttons (todo) +// procedure DrawButtonFace(Canvas: TGfxCanvas; const ARect: TRect; Flags: TButtonFlags); override; + // GroupBox + procedure DrawGroupBox(Canvas: TGfxCanvas; const ARect: TRect; const ALabel: String; WidgetState: TWidgetState); override; + end; + + +var + FOpenSoftStyle: TOpenSoftStyle; + +implementation + + +const + // Some predefined colors: + rgbaDkBlue: TGfxColor = (Red: $0000; Green: $0000; Blue: $8000; Alpha: $0000); + rgbaLtYellow: TGfxColor = (Red: $ffff; Green: $ffff; Blue: $e100; Alpha: $0000); + + rgbaWindowText: TGfxColor = (Red: $0000; Green: $0000; Blue: $0000; Alpha: $0000); + rgbaWindow: TGfxColor = (Red: $efef; Green: $efef; Blue: $efef; Alpha: $0000); + rgbaDkGrey: TGfxColor = (Red: $8686; Green: $8686; Blue: $8686; Alpha: $0000); + rgbaGbAALtGrey: TGfxColor = (Red: $baba; Green: $baba; Blue: $baba; Alpha: $0000); + rgbaGbAADkGrey: TGfxColor = (Red: $7878; Green: $7878; Blue: $7878; Alpha: $0000); + + +{ TOpenSoftStyle } + +function TOpenSoftStyle.GetGUIColor(Color: TColor): TGfxColor; +begin + Result := inherited GetGUIColor(Color); + case Color of + // UI element colors + clScrollBar: Result := rgbaWindow; + clMenu: Result := rgbaWindow; +// clWindow: Result := GetUIColor(clWhite); +// clMenuText: Result := GetUIColor(clBlack); +// clWindowText: Result := GetUIColor(clBlack); +// clAppWorkSpace: Result := GetUIColor(clGray); +// clHighlight: Result := GetUIColor(clNavy); +// clHighlightText: Result := GetUIColor(clWhite); + cl3DFace: Result := rgbaWindow; +// cl3DShadow: Result := rgbaDkWhite; +// clGrayText: Result := GetUIColor(clGray); +// clBtnText: Result := GetUIColor(clBlack); +// cl3DHighlight: Result := GetUIColor(clWhite); + cl3DDkShadow: Result := GetUIColor(clMidnightBlue); +// cl3DLight: Result := GetUIColor(clDarkWhite); +// clInfoText: Result := GetUIColor(clBlack); +// clInfoBk: Result := GetUIColor(clLightYellow); +// +// else Result := GetUIColor(clWhite); + end; + +end; + + +procedure TOpenSoftStyle.DrawGroupBox(Canvas: TGfxCanvas; const ARect: TRect; + const ALabel: String; WidgetState: TWidgetState); +var + TitleWidth, TitleHeight, TopLine: Integer; +begin + TitleWidth := Canvas.TextWidth(ALabel); + TitleHeight := Canvas.FontCellHeight; + TopLine := ARect.Top + TitleHeight div 3; + + Canvas.SetColor(rgbaDkGrey); + // box outline + with ARect do + begin + // top + Canvas.DrawLine(Point(Left + 2, TopLine), Point(Left + 12, TopLine)); + Canvas.DrawLine(Point(Left + TitleWidth + 16, TopLine), Point(Right - 2, TopLine)); + // right + Canvas.DrawLine(Point(Right-1, TopLine + 2), Point(Right-1, Bottom - 2)); + // bottom + Canvas.DrawLine(Point(Right - 3, Bottom-1), Point(Left + 1, Bottom-1)); + // left + Canvas.DrawLine(Point(Left, Bottom - 3), Point(Left, TopLine + 1)); + end; + + // Text caption + SetUIColor(Canvas, clWindowText); + DrawText(Canvas, ARect.TopLeft + Point(14, 0), ALabel, WidgetState); + + { Anti-Aliasing - Top/Left } + Canvas.SetColor(rgbaGbAALtGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(0, TopLine+1)); + Canvas.DrawPoint(ARect.TopLeft + Point(1, TopLine)); + Canvas.SetColor(rgbaGbAADkGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(1, TopLine+1)); + { Anti-Aliasing - Top/Right } + Canvas.SetColor(rgbaGbAALtGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-1, TopLine+1)); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, TopLine)); + Canvas.SetColor(rgbaGbAADkGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, TopLine+1)); + { Anti-Aliasing - Bottom/Right } + Canvas.SetColor(rgbaGbAALtGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-1, ARect.Bottom-2)); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, ARect.Bottom-1)); + Canvas.SetColor(rgbaGbAADkGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(ARect.Right-2, ARect.Bottom-2)); + { Anti-Aliasing - Bottom/Left } + Canvas.SetColor(rgbaGbAALtGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(0, ARect.Bottom-2)); + Canvas.DrawPoint(ARect.TopLeft + Point(1, ARect.Bottom-1)); + Canvas.SetColor(rgbaGbAADkGrey); + Canvas.DrawPoint(ARect.TopLeft + Point(1, ARect.Bottom-2)); +end; + + +initialization + FOpenSoftStyle := TOpenSoftStyle.Create(Application.Display); + +finalization + if Assigned(FOpenSoftStyle) then + FOpenSoftStyle.Free; + +end. + diff --git a/examples/gui/widgetdemo/WidgetDemo.lpi b/examples/gui/widgetdemo/WidgetDemo.lpi new file mode 100644 index 00000000..b4f7bb7d --- /dev/null +++ b/examples/gui/widgetdemo/WidgetDemo.lpi @@ -0,0 +1,71 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + </General> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpGUI_laz"/> + </Item1> + </RequiredPackages> + <Units Count="4"> + <Unit0> + <Filename Value="WidgetDemo.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="WidgetDemo"/> + </Unit0> + <Unit1> + <Filename Value="OpenSoftStyle.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="OpenSoftStyle"/> + </Unit1> + <Unit2> + <Filename Value="../../src/fpgui.pp"/> + <IsPartOfProject Value="True"/> + <UnitName Value="fpGUI"/> + </Unit2> + <Unit3> + <Filename Value="../../../fpGFX/src/gfxbase.pp"/> + <IsPartOfProject Value="True"/> + <UnitName Value="GfxBase"/> + </Unit3> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <Parsing> + <SyntaxOptions> + <IncludeAssertionCode Value="True"/> + <AllowLabel Value="False"/> + </SyntaxOptions> + </Parsing> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits +"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/gui/widgetdemo/WidgetDemo.lpr b/examples/gui/widgetdemo/WidgetDemo.lpr new file mode 100644 index 00000000..391a412f --- /dev/null +++ b/examples/gui/widgetdemo/WidgetDemo.lpr @@ -0,0 +1,360 @@ +program WidgetDemo; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes + ,SysUtils + ,fpgui + ,OpenSoftStyle + ,gfxbase + ; + +type + + { TWidgetDemoForm } + + TWidgetDemoForm = class(TForm) + topLayout: TBoxLayout; + mainLayout: TGridLayout; + MainMenu: TMenuBar; + + topStyleComboLayout: TBoxLayout; + lblStyle: TLabel; + cbStyle: TComboBox; + + topCheckboxLayout: TBoxLayout; + chkStdPalette: TCheckBox; + chkDisable: TCheckBox; + + topLeftGroupBox: TGroupBox; + topLeftGroupBoxLayout: TBoxLayout; + Radio1: TRadioButton; + Radio2: TRadioButton; + Radio3: TRadioButton; + + topRightGroupBox: TGroupBox; + topRightGroupBoxLayout: TBoxLayout; + Button1: TButton; + Button2: TButton; + + StringGrid: TStringGrid; + + bottomRightGroupBox: TGroupBox; + bottomRightGroupBoxLayout: TBoxLayout; + Edit1: TEdit; + Edit2: TEdit; + + bottomButtonLayout: TBoxLayout; + btnExit: TButton; + btnHelp: TButton; + + procedure btnExitClick(Sender: TObject); + procedure Radio1Click(Sender: TObject); + procedure Radio2Click(Sender: TObject); + procedure cbStyleChanged(Sender: TObject); + procedure TranslateToAfrikaans; + procedure TranslateToEnglish; + procedure chkDisableClick(Sender: TObject); + private + procedure CreateTopMenu; + procedure CreateStyleCombo; + procedure CreateTopCheckboxLine; + procedure CreateTopLeftGroupBox; + procedure CreateTopRightGroupBox; + procedure CreateBottomLeftStringGrid; + procedure CreateBottomRightGroupBox; + procedure CreateBottomButtonLayout; + public + constructor Create(AOwner: TComponent); override; + end; + + +{ TWidgetDemoForm } + +procedure TWidgetDemoForm.btnExitClick(Sender: TObject); +begin + Close; +end; + +procedure TWidgetDemoForm.Radio1Click(Sender: TObject); +begin + TranslateToEnglish; +end; + +procedure TWidgetDemoForm.Radio2Click(Sender: TObject); +begin + TranslateToAfrikaans; +end; + +procedure TWidgetDemoForm.cbStyleChanged(Sender: TObject); +begin + if cbStyle.Text = 'OpenSoft' then + begin + if self.Style is TOpenSoftStyle then + exit //==> + else + begin + Style := TOpenSoftStyle.Create(Application.Display); + Redraw; + end; + end + else + begin + if self.Style is TDefaultStyle then + exit //==> + else + begin + Style := Application.DefaultStyle; + Redraw; + end; + end; +end; + +procedure TWidgetDemoForm.TranslateToAfrikaans; +begin + Text := 'Widget Demo - Afrikaans'; + lblStyle.Text := 'Venster Steil:'; + chkStdPalette.Text := 'Standaard kleur tablette'; + chkDisable.Text := 'Ge-deaktiveerde controles'; + topLeftGroupBox.Text := 'Groep Boks Een'; + Radio1.Text := 'Radio knoppie een'; + Radio2.Text := 'Radio knoppie twee'; + Radio3.Text := 'Radio knoppie drie'; + topLeftGroupBox.Text := 'Groep Boks Twee'; + Button1.Text := 'Normal Button'; + Button2.Text := 'Embedded Button'; + bottomRightGroupBox.Text := 'Group Boks Drie'; + Edit1.Text := 'Normale teks'; + Edit2.Text := 'Wagwoord teks'; + btnExit.Text := 'Verlaat Verlaat'; + btnHelp.Text := 'Hulp'; + Redraw; +end; + +procedure TWidgetDemoForm.TranslateToEnglish; +begin + Text := 'Widget Demo - English'; + lblStyle.Text := 'Style:'; + chkStdPalette.Text := 'Standard color palette'; + chkDisable.Text := 'Disable widgets'; + topLeftGroupBox.Text := 'Group Box 1'; + Radio1.Text := 'Radio button 1'; + Radio2.Text := 'Radio button 2'; + Radio3.Text := 'Radio button 3'; + topRightGroupBox.Text := 'Group Box 2'; + Button1.Text := 'Normal Button'; + Button2.Text := 'Embedded Button'; + bottomRightGroupBox.Text := 'Group Box 3'; + Edit1.Text := 'Normal Edit'; + Edit2.Text := 'Password Edit'; + btnExit.Text := 'Exit'; + btnHelp.Text := 'Help'; + Redraw; +end; + +procedure TWidgetDemoForm.chkDisableClick(Sender: TObject); +begin + lblStyle.Enabled := not chkDisable.Checked; + cbStyle.Enabled := not chkDisable.Checked; + chkStdPalette.Enabled := not chkDisable.Checked; + topLeftGroupBox.Enabled := not chkDisable.Checked; + topRightGroupBox.Enabled := not chkDisable.Checked; + StringGrid.Enabled := not chkDisable.Checked; + bottomRightGroupBox.Enabled := not chkDisable.Checked; +end; + +procedure TWidgetDemoForm.CreateTopMenu; +begin + MainMenu := TMenuBar.Create(self); + MainMenu.AddMenu('File'); + MainMenu.AddMenu('Edit'); + MainMenu.AddMenu('Options'); + MainMenu.AddMenu('Windows'); + MainMenu.AddMenu('Help'); +// MainMenu.CanExpandWidth := True; +end; + +procedure TWidgetDemoForm.CreateStyleCombo; +begin + topStyleComboLayout := TBoxLayout.Create(self); + + lblStyle := TLabel.Create('Style:', self); + + cbStyle := TComboBox.Create(self); + cbStyle.CanExpandWidth := True; + cbStyle.Items.Add('Windows'); + cbStyle.Items.Add('WindowsXP'); + cbStyle.Items.Add('Motif'); + cbStyle.Items.Add('ClearLooks'); + cbStyle.Items.Add('OpenSoft'); + cbStyle.OnChange := @cbStyleChanged; + cbStyle.ItemIndex := 0; + + topStyleComboLayout.InsertChild(lblStyle); + topStyleComboLayout.InsertChild(cbStyle); +end; + +procedure TWidgetDemoForm.CreateTopCheckboxLine; +begin + topCheckboxLayout := TBoxLayout.Create(self); + + chkStdPalette := TCheckBox.Create('Standard color palette', self); + chkStdPalette.CanExpandWidth := True; + chkStdPalette.Checked := True; + + chkDisable := TCheckBox.Create('Disable widgets', self); + chkDisable.OnClick :=@chkDisableClick; + + topCheckboxLayout.InsertChild(chkStdPalette); + topCheckboxLayout.InsertChild(chkDisable); +end; + +procedure TWidgetDemoForm.CreateTopLeftGroupBox; +begin + topLeftGroupBox := TGroupBox.Create('Group Box 1', self); + topLeftGroupBox.CanExpandWidth := True; + + topLeftGroupBoxLayout := TBoxLayout.Create(self); + topLeftGroupBoxLayout.Orientation := Vertical; + + Radio1 := TRadioButton.Create('Radio button 1', self); + Radio1.Checked := True; + Radio1.CanExpandWidth := True; + Radio1.OnClick := @Radio1Click; + + Radio2 := TRadioButton.Create('Radio button 2', self); + Radio2.CanExpandWidth := True; + Radio2.OnClick := @Radio2Click; + + Radio3 := TRadioButton.Create('Radio button 3', self); + Radio3.CanExpandWidth := True; + + topLeftGroupBox.InsertChild(topLeftGroupBoxLayout); + topLeftGroupBoxLayout.InsertChild(Radio1); + topLeftGroupBoxLayout.InsertChild(Radio2); + topLeftGroupBoxLayout.InsertChild(Radio3); +end; + +procedure TWidgetDemoForm.CreateTopRightGroupBox; +begin + topRightGroupBox := TGroupBox.Create('Group Box 2', self); + topRightGroupBox.CanExpandWidth := True; + topRightGroupBox.CanExpandHeight := True; + + topRightGroupBoxLayout := TBoxLayout.Create(self); + topRightGroupBoxLayout.Orientation := Vertical; + topRightGroupBoxLayout.VertAlign := vertCenter; + topRightGroupBoxLayout.Spacing := 8; + + Button1 := TButton.Create('Normal Button', self); + Button1.CanExpandWidth := True; + + Button2 := TButton.Create('Embedded Button', self); + Button2.CanExpandWidth := True; + Button2.Embedded := True; + + topRightGroupBox.InsertChild(topRightGroupBoxLayout); + topRightGroupBoxLayout.InsertChild(Button1); + topRightGroupBoxLayout.InsertChild(Button2); +end; + +procedure TWidgetDemoForm.CreateBottomLeftStringGrid; +var + x, y: integer; +begin + StringGrid := TStringGrid.Create(self); + StringGrid.ColCount := 10; + StringGrid.RowCount := 15; + for y := 0 to StringGrid.RowCount - 1 do + for x := 0 to StringGrid.ColCount - 1 do + StringGrid.Cells[x, y] := Format('%d, %d', [x, y]); +end; + +procedure TWidgetDemoForm.CreateBottomRightGroupBox; +begin + bottomRightGroupBox := TGroupBox.Create('Group Box 3', self); + bottomRightGroupBox.CanExpandHeight := True; + bottomRightGroupBox.CanExpandWidth := True; + + bottomRightGroupBoxLayout := TBoxLayout.Create(self); + bottomRightGroupBoxLayout.Orientation := Vertical; + + Edit1 := TEdit.Create('Normal Edit', self); + Edit2 := TEdit.Create('Password Edit', self); + Edit2.PasswordChar := '*'; + + bottomRightGroupBox.InsertChild(bottomRightGroupBoxLayout); + bottomRightGroupBoxLayout.InsertChild(Edit1); + bottomRightGroupBoxLayout.InsertChild(Edit2); +end; + +procedure TWidgetDemoForm.CreateBottomButtonLayout; +begin + bottomButtonLayout := TBoxLayout.Create(self); + bottomButtonLayout.HorzAlign := horzRight; + + btnHelp := TButton.Create('Help', self); + + btnExit := TButton.Create('Exit', self); + btnExit.OnClick := @btnExitClick; + + bottomButtonLayout.InsertChild(btnHelp); + bottomButtonLayout.InsertChild(btnExit); +end; + +constructor TWidgetDemoForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Text := 'Widget Demo'; + BorderWidth := 8; +// WindowType := wtWindow; + + topLayout := TBoxLayout.Create(self); + topLayout.Orientation := Vertical; + mainLayout := TGridLayout.Create(self); + mainLayout.RowCount := 2; + + CreateTopMenu; + topLayout.InsertChild(MainMenu); + + CreateStyleCombo; + topLayout.InsertChild(topStyleComboLayout); + + CreateTopCheckboxLine; + topLayout.InsertChild(topCheckboxLayout); + + CreateTopLeftGroupBox; + mainLayout.AddWidget(topLeftGroupBox, 0, 0, 1, 1); + + CreateTopRightGroupBox; + mainLayout.AddWidget(topRightGroupBox, 1, 0, 1, 1); + + CreateBottomLeftStringGrid; + mainLayout.AddWidget(StringGrid, 0, 1, 1, 1); + + CreateBottomRightGroupBox; + mainLayout.AddWidget(bottomRightGroupBox, 1, 1, 1, 1); + + topLayout.InsertChild(mainLayout); + + CreateBottomButtonLayout; + topLayout.InsertChild(bottomButtonLayout); + + Child := topLayout; +end; + + +var + WidgetDemoForm: TWidgetDemoForm; + +begin + WidgetDemoForm := TWidgetDemoForm.Create(nil); + Application.AddForm(WidgetDemoForm); + Application.Run; + WidgetDemoForm.Free; +end. + diff --git a/examples/gui/widgettest/Makefile b/examples/gui/widgettest/Makefile new file mode 100644 index 00000000..2c9fa63e --- /dev/null +++ b/examples/gui/widgettest/Makefile @@ -0,0 +1,1320 @@ +# +# Makefile generated by fpcmake v1.00 [2000/12/14] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION FPCOPT + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override EXEOBJECTS+=widgettest + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2h + +# Directories + + +# Packages + +override PACKAGES+=rtl fcl fpgfx fpgui + +# Libraries + + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +ifdef inUnix +PPAS=ppas.sh +else +ifdef inOS2 +PPAS=ppas.cmd +else +PPAS=ppas.bat +endif +endif + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 +PACKAGEFCL=1 +PACKAGEFPGFX=1 +PACKAGEFPGUI=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef PACKAGEFCL +ifneq ($(wildcard $(FPCDIR)/fcl),) +ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) +PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) +else +PACKAGEDIR_FCL=$(FPCDIR)/fcl +endif +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +UNITDIR_FCL=$(PACKAGEDIR_FCL) +else +PACKAGEDIR_FCL= +ifneq ($(wildcard $(UNITSDIR)/fcl),) +ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) +UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) +else +UNITDIR_FCL=$(UNITSDIR)/fcl +endif +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override NEEDUNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef PACKAGEFPGFX +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx/$(OS_TARGET)),) +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx/$(OS_TARGET) +else +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +else +PACKAGEDIR_FPGFX= +ifneq ($(wildcard $(UNITSDIR)/fpgfx),) +ifneq ($(wildcard $(UNITSDIR)/fpgfx/$(OS_TARGET)),) +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx/$(OS_TARGET) +else +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx +endif +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override NEEDUNITDIR+=$(UNITDIR_FPGFX) +endif +endif +ifdef PACKAGEFPGUI +ifneq ($(wildcard $(PACKAGESDIR)/fpgui),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgui/$(OS_TARGET)),) +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui/$(OS_TARGET) +else +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGUI)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgui +package_fpgui: + $(MAKE) -C $(PACKAGEDIR_FPGUI) all +endif +UNITDIR_FPGUI=$(PACKAGEDIR_FPGUI) +else +PACKAGEDIR_FPGUI= +ifneq ($(wildcard $(UNITSDIR)/fpgui),) +ifneq ($(wildcard $(UNITSDIR)/fpgui/$(OS_TARGET)),) +UNITDIR_FPGUI=$(UNITSDIR)/fpgui/$(OS_TARGET) +else +UNITDIR_FPGUI=$(UNITSDIR)/fpgui +endif +else +UNITDIR_FPGUI= +endif +endif +ifdef UNITDIR_FPGUI +override NEEDUNITDIR+=$(UNITDIR_FPGUI) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Exes +##################################################################### + +.PHONY: fpc_exes + +ifdef EXEOBJECTS +override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) + +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) + +endif + +fpc_exes: $(EXEFILES) + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) +ifdef USETAR + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) + cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR) +else + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) + cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/examples/gui/widgettest/Makefile.fpc b/examples/gui/widgettest/Makefile.fpc new file mode 100644 index 00000000..57009620 --- /dev/null +++ b/examples/gui/widgettest/Makefile.fpc @@ -0,0 +1,10 @@ +# +# Makefile.fpc for fpGUI WidgetTest example +# + +[targets] +programs=widgettest + +[require] +options=-S2h +packages=fcl fpgfx fpgui diff --git a/examples/gui/widgettest/checkboxform.frm b/examples/gui/widgettest/checkboxform.frm new file mode 100644 index 00000000..cc03310d --- /dev/null +++ b/examples/gui/widgettest/checkboxform.frm @@ -0,0 +1,17 @@ +object CheckBoxForm: TCheckBoxForm + BorderWidth = 8 + Text = 'Check box test' + object Box: TBoxLayout + Orientation = Vertical + object GrayCheckBox: TCheckBox + Text = 'Gray other check boxes' + OnClick = GrayCheckBoxClick + end + object CheckBox1: TCheckBox + Text = 'First other check box' + end + object CheckBox2: TCheckBox + Text = 'Second other check box' + end + end +end diff --git a/examples/gui/widgettest/comboboxform.frm b/examples/gui/widgettest/comboboxform.frm new file mode 100644 index 00000000..23dd1f07 --- /dev/null +++ b/examples/gui/widgettest/comboboxform.frm @@ -0,0 +1,19 @@ +object ComboBoxForm: TComboBoxForm + BorderWidth = 8 + Text = 'Combo box test' + OnCreate = FormCreate + object VertBox: TBoxLayout + Orientation = Vertical + object GrayCheckBox: TCheckBox + Text = 'Gray combo boxes' + OnClick = GrayCheckBoxClick + end + object BetaLabel: TLabel + Text = '(the drop-down lists are work in progress)' + end + object ComboBox1: TComboBox + end + object ComboBox2: TComboBox + end + end +end diff --git a/examples/gui/widgettest/editform.frm b/examples/gui/widgettest/editform.frm new file mode 100644 index 00000000..51c2b888 --- /dev/null +++ b/examples/gui/widgettest/editform.frm @@ -0,0 +1,74 @@ +object EditForm: TEditForm + BorderWidth = 8 + Text = 'Edit field test' + object Grid: TGridLayout + ColCount = 3 + RowCount = 4 + GridPositions = < + item + Widget = Label1 + end + item + x = 1 + Widget = Edit1 + end + item + x = 2 + Widget = GrayCheckBox1 + end + item + y = 1 + width = 3 + Widget = Separator + end + item + y = 2 + Widget = Label2 + end + item + x = 1 + y = 2 + Widget = Edit2 + end + item + x = 2 + y = 2 + Widget = GrayCheckBox2 + end + item + x = 1 + y = 3 + Widget = PasswordDisplay + end> + object Label1: TLabel + Text = 'Normal edit field:' + CanExpandWidth = False + end + object Edit1: TEdit + Text = 'Edit1' + end + object GrayCheckBox1: TCheckBox + Text = 'Disabled' + OnClick = GrayCheckBox1Click + end + object Separator: TSeparator + end + object Label2: TLabel + Text = 'Password edit field:' + CanExpandWidth = False + end + object Edit2: TEdit + PasswordChar = '*' + Text = 'Edit2' + OnChange = Edit2Change + end + object GrayCheckBox2: TCheckBox + Text = 'Disabled' + OnClick = GrayCheckBox2Click + end + object PasswordDisplay: TLabel + Text = '(Password field)' + CanExpandWidth = False + end + end +end diff --git a/examples/gui/widgettest/gridform.frm b/examples/gui/widgettest/gridform.frm new file mode 100644 index 00000000..43d673fd --- /dev/null +++ b/examples/gui/widgettest/gridform.frm @@ -0,0 +1,9 @@ +object GridForm: TGridForm + BorderWidth = 8 + Text = 'Grid test' + OnCreate = FormCreate + object StringGrid: TStringGrid + ColCount = 10 + RowCount = 15 + end +end diff --git a/examples/gui/widgettest/groupboxform.frm b/examples/gui/widgettest/groupboxform.frm new file mode 100644 index 00000000..85ddff8f --- /dev/null +++ b/examples/gui/widgettest/groupboxform.frm @@ -0,0 +1,49 @@ +object GroupBoxForm: TGroupBoxForm + BorderWidth = 8 + Text = 'Group box test' + object HorzBox: TBoxLayout + VertAlign = vertTop + object GroupBox1: TGroupBox + Text = 'Group box #1' + object VertBox1: TBoxLayout + Orientation = Vertical + object GrayCheckBox: TCheckBox + Text = 'Gray other group box' + OnClick = GrayCheckBoxClick + end + object Button: TButton + Enabled = False + Text = 'Reset radio buttons' + OnClick = ButtonClick + end + end + end + object GroupBox2: TGroupBox + Text = 'Group box #2' + object VertBox2: TBoxLayout + Orientation = Vertical + object Radio1: TRadioButton + Checked = True + Text = 'Option 1' + OnClick = RadioButtonClick + end + object Radio2: TRadioButton + Text = 'Option 2' + OnClick = RadioButtonClick + end + object Radio3: TRadioButton + Text = 'Option 3' + OnClick = RadioButtonClick + end + object Radio4: TRadioButton + Text = 'Option 4' + OnClick = RadioButtonClick + end + object Radio5: TRadioButton + Text = 'Option 5' + OnClick = RadioButtonClick + end + end + end + end +end diff --git a/examples/gui/widgettest/listboxform.frm b/examples/gui/widgettest/listboxform.frm new file mode 100644 index 00000000..7d7c4f4c --- /dev/null +++ b/examples/gui/widgettest/listboxform.frm @@ -0,0 +1,23 @@ +object ListBoxForm: TListBoxForm + BorderWidth = 8 + Text = 'List box test' + object ListBox: TListBox + Items.Strings = ( + 'procedure KeyPressed(var Event: TXKeyPressedEvent); message X.KeyPress;' + 'procedure KeyReleased(var Event: TXKeyReleasedEvent); message X.KeyRelease;' + 'procedure ButtonPressed(var Event: TXButtonPressedEvent); message X.ButtonPress;' + 'procedure ButtonReleased(var Event: TXButtonReleasedEvent); message X.ButtonRelease;' + 'procedure EnterWindow(var Event :TXEnterWindowEvent); message X.EnterNotify;' + 'procedure LeaveWindow(var Event :TXLeaveWindowEvent); message X.LeaveNotify;' + 'procedure PointerMoved(var Event: TXPointerMovedEvent); message X.MotionNotify;' + 'procedure Expose(var Event: TXExposeEvent); message X.Expose;' + 'procedure FocusIn(var Event: TXFocusInEvent); message X.FocusIn;' + 'procedure FocusOut(var Event: TXFocusOutEvent); message X.FocusOut;' + 'procedure Map(var Event: TXMapEvent); message X.MapNotify;' + 'procedure Unmap(var Event: TXUnmapEvent); message X.UnmapNotify;' + 'procedure Reparent(var Event: TXReparentEvent); message X.ReparentNotify;' + 'procedure DestroyWindow(var Event: TXDestroyWindowEvent); message X.DestroyNotify;' + 'procedure Configure(var Event: TXConfigureEvent); message X.ConfigureNotify;' + 'procedure ClientMessage(var Event: TXClientMessageEvent); message X.ClientMessage;') + end +end diff --git a/examples/gui/widgettest/mainform.frm b/examples/gui/widgettest/mainform.frm new file mode 100644 index 00000000..d0e5f62f --- /dev/null +++ b/examples/gui/widgettest/mainform.frm @@ -0,0 +1,87 @@ +object MainForm: TMainForm
+ Text = 'Widget tests'
+ BorderWidth = 8
+ WindowOptions = [woWindow]
+ object Box: TBoxLayout
+ CanExpandWidth = False
+ Spacing = 8
+ Orientation = Vertical
+ object Label: TLabel
+ CanExpandWidth = True
+ Text = 'Choose a test form:'
+ end
+ object CheckboxBtn: TButton
+ CanExpandWidth = True
+ Text = 'Check boxes'
+ OnClick = CheckboxBtnClick
+ end
+ object RadioButtonBtn: TButton
+ CanExpandWidth = True
+ Text = 'Radio buttons'
+ OnClick = RadioButtonBtnClick
+ end
+ object GroupBoxBtn: TButton
+ CanExpandWidth = True
+ Text = 'Group boxes'
+ OnClick = GroupBoxBtnClick
+ end
+ object EditBtn: TButton
+ CanExpandWidth = True
+ Text = 'Edit fields'
+ OnClick = EditBtnClick
+ end
+ object ScrollBarBtn: TButton
+ CanExpandWidth = True
+ Text = 'Scroll bars'
+ OnClick = ScrollBarBtnClick
+ end
+ object ScrollBoxBtn: TButton
+ CanExpandWidth = True
+ Text = 'Scroll boxes'
+ OnClick = ScrollBoxBtnClick
+ end
+ object ListBoxBtn: TButton
+ CanExpandWidth = True
+ Text = 'List boxes'
+ OnClick = ListBoxBtnClick
+ end
+ object ComboBoxBtn: TButton
+ CanExpandWidth = True
+ Text = 'Combo boxes'
+ OnClick = ComboBoxBtnClick
+ end
+ object GridBtn: TButton
+ CanExpandWidth = True
+ Text = 'Grids'
+ OnClick = GridBtnClick
+ end
+ object MenuBtn: TButton
+ CanExpandWidth = True
+ Text = 'Menus'
+ OnClick = MenuBtnClick
+ end
+ object PanelBtn: TButton
+ CanExpandWidth = True
+ Text = 'Panel'
+ OnClick = PanelBtnClick
+ end
+ object ProgressBarBtn: TButton
+ CanExpandWidth = True
+ Text = 'Progress Bar'
+ OnClick = ProgressBarBtnClick
+ end
+ object StdDialogBtn: TButton
+ CanExpandWidth = True
+ Text = 'Std Dialog'
+ OnClick = StdDialogBtnClick
+ Enabled = False
+ end
+ object Separator: TSeparator
+ end
+ object ExitBtn: TButton
+ CanExpandWidth = True
+ Text = 'Exit'
+ OnClick = ExitBtnClick
+ end
+ end
+end
diff --git a/examples/gui/widgettest/radiobuttonform.frm b/examples/gui/widgettest/radiobuttonform.frm new file mode 100644 index 00000000..eac18c90 --- /dev/null +++ b/examples/gui/widgettest/radiobuttonform.frm @@ -0,0 +1,33 @@ +object RadioButtonForm: TRadioButtonForm + BorderWidth = 8 + Text = 'Radio button test' + object Box: TBoxLayout + Orientation = Vertical + object GrayCheckbox: TCheckbox + Text = 'Gray radio buttons' + OnClick = GrayCheckboxClick + end + object HorzBox: TBoxLayout + object ButtonBox1: TBoxLayout + Orientation = Vertical + object Radio1a: TRadioButton + Checked = True + Text = 'Button 1 a' + end + object Radio1b: TRadioButton + Text = 'Button 1 b' + end + end + object ButtonBox2: TBoxLayout + Orientation = Vertical + object Radio2a: TRadioButton + Text = 'Button 2 a' + end + object Radio2b: TRadioButton + Checked = True + Text = 'Button 2 b' + end + end + end + end +end diff --git a/examples/gui/widgettest/scrollbarform.frm b/examples/gui/widgettest/scrollbarform.frm new file mode 100644 index 00000000..5c238e23 --- /dev/null +++ b/examples/gui/widgettest/scrollbarform.frm @@ -0,0 +1,175 @@ +object ScrollBarForm: TScrollBarForm + BorderWidth = 8 + Text = 'Scroll bar test' + object VertBox: TBoxLayout + Orientation = Vertical + object GrayCheckBox: TCheckBox + Text = 'Gray everything' + OnClick = GrayCheckBoxClick + end + object HorzBox: TBoxLayout + object HorzGrid: TGridLayout + ColCount = 3 + RowCount = 6 + ColSpacing = 8 + GridPositions = < + item + x = 2 + Widget = Col3Label + end + item + y = 1 + Widget = Label1 + end + item + x = 1 + y = 1 + Widget = ScrollBar1 + end + item + x = 2 + y = 1 + Widget = PosLabel1 + end + item + y = 2 + Widget = Label2 + end + item + x = 1 + y = 2 + Widget = ScrollBar2 + end + item + x = 2 + y = 2 + Widget = PosLabel2 + end + item + y = 3 + Widget = Label3 + end + item + x = 1 + y = 3 + Widget = ScrollBar3 + end + item + x = 2 + y = 3 + Widget = PosLabel3 + end + item + y = 4 + Widget = Label4 + end + item + x = 1 + y = 4 + Widget = ScrollBar4 + end + item + x = 2 + y = 4 + Widget = PosLabel4 + end + item + y = 5 + Widget = Label5 + end + item + x = 1 + y = 5 + Widget = ScrollBar5 + end + item + x = 2 + y = 5 + Widget = PosLabel5 + end> + object Col3Label: TLabel + Alignment = taCenter + Text = 'Position' + end + object Label1: TLabel + Alignment = taRightJustify + Text = '0..1, PageSize=0:' + end + object ScrollBar1: TScrollBar + Min = 0 + Max = 1 + OnChange = ScrollBar1Change + end + object PosLabel1: TLabel + Alignment = taCenter + Text = '---' + end + object Label2: TLabel + Alignment = taRightJustify + Text = '0..1, PageSize=1:' + end + object ScrollBar2: TScrollBar + Max = 1 + PageSize = 1 + OnChange = ScrollBar2Change + end + object PosLabel2: TLabel + Alignment = taCenter + Text = '---' + end + object Label3: TLabel + Alignment = taRightJustify + Text = '-2..3, PageSize=0:' + end + object ScrollBar3: TScrollBar + Min = -2 + Max = 3 + OnChange = ScrollBar3Change + end + object PosLabel3: TLabel + Alignment = taCenter + Text = '---' + end + object Label4: TLabel + Alignment = taRightJustify + Text = '-5..9, PageSize=4:' + end + object ScrollBar4: TScrollBar + Min = -5 + Max = 9 + PageSize = 4 + OnChange = ScrollBar4Change + end + object PosLabel4: TLabel + Alignment = taCenter + Text = '---' + end + object Label5: TLabel + Alignment = taRightJustify + Text = '-100..200, PageSize=7:' + end + object ScrollBar5: TScrollBar + Min = -100 + Max = 200 + PageSize = 7 + OnChange = ScrollBar5Change + end + object PosLabel5: TLabel + Alignment = taCenter + Text = '---' + end + end + object VertBar: TSeparator + Orientation = Vertical + end + object VertLabel: TLabel + Text = 'Vertical:' + end + object VertScrollBar: TScrollBar + Orientation = Vertical + Min = -2 + Max = 3 + end + end + end +end diff --git a/examples/gui/widgettest/scrollboxform.frm b/examples/gui/widgettest/scrollboxform.frm new file mode 100644 index 00000000..b7e5412d --- /dev/null +++ b/examples/gui/widgettest/scrollboxform.frm @@ -0,0 +1,14 @@ +object ScrollBoxForm: TScrollBoxForm
+ BorderWidth = 8
+ Text = 'Scroll box test'
+ WindowOptions = [woWindow]
+ object VertLayout: TBoxLayout
+ Orientation = Vertical
+ object Label1: TLabel
+ CanExpandWidth = True
+ Text = 'ScrollBox should be transparent in this demo.'
+ end
+ object ScrollBox: TScrollBox
+ end
+ end
+end
diff --git a/examples/gui/widgettest/widgettest.lpi b/examples/gui/widgettest/widgettest.lpi new file mode 100644 index 00000000..68a02fd5 --- /dev/null +++ b/examples/gui/widgettest/widgettest.lpi @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + <AlwaysBuild Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + </General> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="LCL"/> + <MinVersion Major="1" Valid="True"/> + </Item1> + <Item2> + <PackageName Value="fpGUI_laz"/> + </Item2> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="widgettest.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="WidgetTest"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <Parsing> + <SyntaxOptions> + <IncludeAssertionCode Value="True"/> + <AllowLabel Value="False"/> + </SyntaxOptions> + </Parsing> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits -dTraceEventsX -dDebugX +"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/examples/gui/widgettest/widgettest.pas b/examples/gui/widgettest/widgettest.pas new file mode 100644 index 00000000..1bc7654e --- /dev/null +++ b/examples/gui/widgettest/widgettest.pas @@ -0,0 +1,749 @@ +program WidgetTest; + +uses + SysUtils + ,Classes + ,gfxbase + ,fpgui + ; + +type + + // forward declarations + TCheckBoxForm = class; + TRadioButtonForm = class; + TGroupBoxForm = class; + TEditForm = class; + TScrollBarForm = class; + TScrollBoxForm = class; + TListBoxForm = class; + TComboBoxForm = class; + TGridForm = class; + TMenuForm = class; + TPanelForm = class; + TProgressBarForm = class; + + { TMainForm } + + TMainForm = class(TForm) + private + _frmCheckBox: TCheckBoxForm; + _frmRadioButton: TRadioButtonForm; + _frmGroupBox: TGroupBoxForm; + _frmEdit: TEditForm; + _frmScrollBar: TScrollBarForm; + _frmScrollBox: TScrollBoxForm; + _frmListBox: TListBoxForm; + _frmComboBox: TComboBoxForm; + _frmGrid: TGridForm; + _frmMenu: TMenuForm; + _frmPanel: TPanelForm; + _frmProgressBar: TProgressBarForm; + public + destructor Destroy; override; + published + Box: TBoxLayout; + Title: TLabel; + CheckboxBtn: TButton; + RadioButtonBtn: TButton; + GroupBoxBtn: TButton; + EditBtn: TButton; + ScrollBarBtn: TButton; + ScrollBoxBtn: TButton; + ListBoxBtn: TButton; + ComboBoxBtn: TButton; + GridBtn: TButton; + MenuBtn: TButton; + PanelBtn: TButton; + ProgressBarBtn: TButton; + StdDialogBtn: TButton; + Separator: TSeparator; + ExitBtn: TButton; + procedure CheckBoxBtnClick(Sender: TObject); + procedure RadioButtonBtnClick(Sender: TObject); + procedure GroupBoxBtnClick(Sender: TObject); + procedure EditBtnClick(Sender: TObject); + procedure ScrollBarBtnClick(Sender: TObject); + procedure ScrollBoxBtnClick(Sender: TObject); + procedure ListBoxBtnClick(Sender: TObject); + procedure ComboBoxBtnClick(Sender: TObject); + procedure GridBtnClick(Sender: TObject); + procedure ExitBtnClick(Sender: TObject); + procedure StdDialogBtnClick(Sender: TObject); + procedure MenuBtnClick(Sender: TObject); + procedure PanelBtnClick(Sender: TObject); + procedure ProgressBarBtnClick(Sender: TObject); + end; + + + TTestForm = class(TForm) + end; + + + TCheckBoxForm = class(TTestForm) + Box: TBoxLayout; + GrayCheckBox, CheckBox1, CheckBox2: TCheckBox; + procedure GrayCheckBoxClick(Sender: TObject); + end; + + + TRadioButtonForm = class(TTestForm) + Box, HorzBox, ButtonBox1, ButtonBox2: TBoxLayout; + GrayCheckBox: TCheckBox; + Radio1a, Radio1b, Radio2a, Radio2b: TRadioButton; + procedure GrayCheckBoxClick(Sender: TObject); + end; + + + TGroupBoxForm = class(TTestForm) + HorzBox, VertBox1, VertBox2: TBoxLayout; + GroupBox1, GroupBox2: TGroupBox; + GrayCheckBox: TCheckBox; + Button: TButton; + Radio1, Radio2, Radio3, Radio4, Radio5: TRadioButton; + procedure GrayCheckBoxClick(Sender: TObject); + procedure ButtonClick(Sender: TObject); + procedure RadioButtonClick(Sender: TObject); + end; + + + TEditForm = class(TTestForm) + Grid: TGridLayout; + VertBox, HorzBox1, HorzBox2: TBoxLayout; + Label1, Label2, PasswordDisplay: TLabel; + Edit1, Edit2: TEdit; + GrayCheckBox1, GrayCheckBox2: TCheckBox; + Separator: TSeparator; + procedure GrayCheckBox1Click(Sender: TObject); + procedure GrayCheckBox2Click(Sender: TObject); + procedure Edit2Change(Sender: TObject); + end; + + + TScrollBarForm = class(TTestForm) + VertLayout: TBoxLayout; + GrayCheckBox: TCheckBox; + HorzBox: TBoxLayout; + HorzGrid, VertGrid: TGridLayout; + VertBar: TSeparator; + VertLabel, Label1, Label2, Label3, Label4, Label5: TLabel; + PosLabel1, PosLabel2, PosLabel3, PosLabel4, PosLabel5: TLabel; + VertScrollBar, ScrollBar1, ScrollBar2, ScrollBar3, + ScrollBar4, ScrollBar5: TScrollBar; + procedure GrayCheckBoxClick(Sender: TObject); + procedure ScrollBar1Change(Sender: TObject); + procedure ScrollBar2Change(Sender: TObject); + procedure ScrollBar3Change(Sender: TObject); + procedure ScrollBar4Change(Sender: TObject); + procedure ScrollBar5Change(Sender: TObject); + end; + + + TScrollBoxForm = class(TTestForm) + VertLayout: TBoxLayout; + Label1: TLabel; + ScrollBox: TScrollBox; + end; + + + TListBoxForm = class(TTestForm) + ListBox: TListBox; + end; + + + TComboBoxForm = class(TTestForm) + published + VertLayout: TBoxLayout; + GrayCheckBox: TCheckBox; + BetaLabel: TLabel; + ComboBox1: TComboBox; + ComboBox2: TComboBox; + procedure GrayCheckBoxClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + end; + + + TGridForm = class(TTestForm) + StringGrid: TStringGrid; + procedure FormCreate(Sender: TObject); + end; + + + TMenuForm = class(TTestForm) + private + FLayout: TBoxLayout; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + BoxLayout: TBoxLayout; + MainMenu: TMenuBar; + Title: TLabel; + p1, p2, p3, p4, p5, p6: TPanel; + HBox: TBoxLayout; + end; + + + TPanelForm = class(TTestForm) + private + procedure RadioButtonClick(Sender: TObject); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + MainLayout: TBoxLayout; + StyleGroup: TGroupBox; + rbPlain, rbLowered, rbRaised: TRadioButton; + VBox1: TBoxLayout; + Panel: TPanel; + Separator: TSeparator; + end; + + + TProgressBarForm = class(TTestForm) + private + procedure cbShowPercentClick(Sender: TObject); + procedure RadioButtonClick(Sender: TObject); + procedure GeneratePercentage(Sender: TObject); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + MainLayout: TGridLayout; + VBox: TBoxLayout; + PB: TProgressBar; + cbShowPercent: TCheckBox; + gbColor: TGroupBox; + rbBlue: TRadioButton; + rbRed: TRadioButton; + rbGreen: TRadioButton; + Separator: TSeparator; + btnRandom: TButton; + end; + + +{ TMenuForm } + +constructor TMenuForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Name := 'MenuForm'; + Text := 'Menu Test'; + + BoxLayout := TBoxLayout.Create(self); + BoxLayout.Orientation := Vertical; + + MainMenu := TMenuBar.Create(self); + BoxLayout.InsertChild(MainMenu); + FLayout := TBoxLayout.Create(self); + FLayout.Spacing := 0; + FLayout.BorderSpacing := 6; + FLayout.HorzAlign := horzLeft; + MainMenu.InsertChild(FLayout); + +{ + MainMenu.AddMenu('File'); + MainMenu.AddMenu('Edit'); + MainMenu.AddMenu('Options'); + MainMenu.AddMenu('Windows'); + MainMenu.AddMenu('Help'); +} + + FLayout.InsertChild(TPanel.Create('File', self)); + FLayout.InsertChild(TPanel.Create('Edit', self)); + + HBox := TBoxLayout.Create(self); + HBox.HorzAlign := horzLeft; + HBox.Spacing := 0; + BoxLayout.InsertChild(HBox); + p1 := TPanel.Create('File', self); + p1.BevelStyle := bsPlain; + p2 := TPanel.Create('Edit', self); + p2.BevelStyle := bsPlain; + p3 := TPanel.Create('Options', self); + p3.BevelStyle := bsPlain; + p4 := TPanel.Create('Windows', self); + p4.BevelStyle := bsPlain; + p5 := TPanel.Create('Help', self); + p5.BevelStyle := bsPlain; +// HBox.InsertChild(p1); +// HBox.InsertChild(p2); + HBox.InsertChild(p3); + HBox.InsertChild(p4); + HBox.InsertChild(p5); + HBox.InsertChild(TPanel.Create('Testing', self)); + + + Title := TLabel.Create(self); + Title.CanExpandWidth := True; + Title.Alignment := taCenter; + Title.Text := 'This is work in progress...'; + Title.FontColor := clBlue; + BoxLayout.InsertChild(Title); + + Child := BoxLayout; +end; + +destructor TMenuForm.Destroy; +begin + inherited Destroy; +end; + +{ TPanelForm } + +procedure TPanelForm.RadioButtonClick(Sender: TObject); +begin + case TRadioButton(Sender).Tag of + 1: Panel.BevelStyle := bsPlain; + 2: Panel.BevelStyle := bsLowered; + 3: Panel.BevelStyle := bsRaised; + end; +end; + +constructor TPanelForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Name := 'PanelForm'; + Text := 'Panel Test'; + BorderWidth := 8; + + MainLayout := TBoxLayout.Create(self); + MainLayout.Orientation := Vertical; + + StyleGroup := TGroupBox.Create('Bevel Style:', self); + StyleGroup.CanExpandWidth := True; + MainLayout.InsertChild(StyleGroup); + + VBox1 := TBoxLayout.Create(self); + VBox1.Orientation := Vertical; + StyleGroup.InsertChild(VBox1); + + rbPlain := TRadioButton.Create('Plain', self); + rbPlain.Tag := 1; + rbPlain.OnClick := @RadioButtonClick; + rbLowered := TRadioButton.Create('Lowered', self); + rbLowered.Tag := 2; + rbLowered.OnClick := @RadioButtonClick; + rbRaised := TRadioButton.Create('Raised', self); + rbRaised.Tag := 3; + rbRaised.OnClick := @RadioButtonClick; + rbRaised.Checked := True; + VBox1.InsertChild(rbPlain); + VBox1.InsertChild(rbLowered); + VBox1.InsertChild(rbRaised); + + Separator := TSeparator.Create(self); + MainLayout.InsertChild(Separator); + + Panel := TPanel.Create('My Panel', self); + MainLayout.InsertChild(Panel); + + Child := MainLayout; +end; + +destructor TPanelForm.Destroy; +begin + inherited Destroy; +end; + + +{ TProgressBarForm } + +procedure TProgressBarForm.cbShowPercentClick(Sender: TObject); +begin + PB.ShowPercentage := cbShowPercent.Checked; +end; + +procedure TProgressBarForm.RadioButtonClick(Sender: TObject); +begin + case TRadioButton(Sender).Tag of + 1: PB.FillColor := clRed; + 2: PB.FillColor := clGreen; + 3: PB.FillColor := clBlue; + end; +end; + +procedure TProgressBarForm.GeneratePercentage(Sender: TObject); +begin + PB.Position := Random(100); +end; + +constructor TProgressBarForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Text := 'Progress Bar Demo'; + BorderWidth := 8; + + MainLayout := TGridLayout.Create(self); + MainLayout.RowCount := 4; + MainLayout.ColCount := 2; + + VBox := TBoxLayout.Create(self); + VBox.Orientation := Vertical; + + gbColor := TGroupBox.Create('Fill Color', self); + rbRed := TRadioButton.Create('Red', self); + rbRed.Tag := 1; + rbRed.OnClick := @RadioButtonClick; + rbRed.Checked := True; + + rbGreen := TRadioButton.Create('Green', self); + rbGreen.Tag := 2; + rbGreen.OnClick := @RadioButtonClick; + + rbBlue := TRadioButton.Create('Blue', self); + rbBlue.Tag := 3; + rbBlue.OnClick := @RadioButtonClick; + + VBox.InsertChild(rbRed); + VBox.InsertChild(rbGreen); + VBox.InsertChild(rbBlue); + gbColor.InsertChild(VBox); + MainLayout.AddWidget(gbColor, 0, 0, 1, 2); + + cbShowPercent := TCheckbox.Create('Show Percentage', self); + cbShowPercent.Checked := True; + cbShowPercent.OnClick := @cbShowPercentClick; + cbShowPercent.CanExpandWidth := True; + MainLayout.AddWidget(cbShowPercent, 1, 0, 1, 1); + + btnRandom := TButton.Create('Randomize', self); + btnRandom.OnClick := @GeneratePercentage; + MainLayout.AddWidget(btnRandom, 1, 1, 1, 1); + + Separator := TSeparator.Create(self); + MainLayout.AddWidget(Separator, 0, 2, 2, 1); + + PB := TProgressBar.Create('', self); + PB.Position := 75; + MainLayout.AddWidget(PB, 0, 3, 2, 1); + + Child := MainLayout; +end; + +destructor TProgressBarForm.Destroy; +begin + inherited Destroy; +end; + + +// ------------------------------------------------------------------- +// TMainForm +// ------------------------------------------------------------------- + +destructor TMainForm.Destroy; +begin + _frmCheckBox.Free; + _frmRadioButton.Free; + _frmGroupBox.Free; + _frmEdit.Free; + _frmScrollBar.Free; + _frmScrollBox.Free; + _frmListBox.Free; + _frmComboBox.Free; + _frmGrid.Free; + _frmMenu.Free; + _frmPanel.Free; + _frmProgressBar.Free; + inherited Destroy; +end; + + +procedure TMainForm.CheckBoxBtnClick(Sender: TObject); +begin + if Assigned(_frmCheckBox) then + _frmCheckBox.Show + else + Application.CreateForm(TCheckBoxForm, _frmCheckBox); +end; + + +procedure TMainForm.RadioButtonBtnClick(Sender: TObject); +begin + if Assigned(_frmRadioButton) then + _frmRadioButton.Show + else + Application.CreateForm(TRadioButtonForm, _frmRadioButton); +end; + + +procedure TMainForm.GroupBoxBtnClick(Sender: TObject); +begin + if Assigned(_frmGroupBox) then + _frmGroupBox.Show + else + Application.CreateForm(TGroupBoxForm, _frmGroupBox); +end; + + +procedure TMainForm.EditBtnClick(Sender: TObject); +begin + if Assigned(_frmEdit) then + _frmEdit.Show + else + Application.CreateForm(TEditForm, _frmEdit); +end; + + +procedure TMainForm.ScrollBarBtnClick(Sender: TObject); +begin + if Assigned(_frmScrollBar) then + _frmScrollBar.Show + else + Application.CreateForm(TScrollBarForm, _frmScrollBar); +end; + + +procedure TMainForm.ScrollBoxBtnClick(Sender: TObject); +begin + if Assigned(_frmScrollBox) then + _frmScrollBox.Show + else + Application.CreateForm(TScrollBoxForm, _frmScrollBox); +end; + + +procedure TMainForm.ListBoxBtnClick(Sender: TObject); +begin + if Assigned(_frmListBox) then + _frmListBox.Show + else + Application.CreateForm(TListBoxForm, _frmListBox); +end; + + +procedure TMainForm.ComboBoxBtnClick(Sender: TObject); +begin + if Assigned(_frmComboBox) then + _frmComboBox.Show + else + Application.CreateForm(TComboBoxForm, _frmComboBox); +end; + + +procedure TMainForm.GridBtnClick(Sender: TObject); +begin + if Assigned(_frmGrid) then + _frmGrid.Show + else + Application.CreateForm(TGridForm, _frmGrid); +end; + + +procedure TMainForm.ExitBtnClick(Sender: TObject); +begin + Close; +end; + + +procedure TMainForm.StdDialogBtnClick(Sender: TObject); +var + dlg: TStandardDialog; +begin + {$Note This needs to be reworked completely! } + if Assigned(dlg) then + dlg.Show + else + Application.CreateForm(TStandardDialog, dlg); +// dlg := TStandardDialog.Create(self); + +// dlg.Text := 'This is a single line of text.'; +// dlg.Show; +end; + + +procedure TMainForm.MenuBtnClick(Sender: TObject); +begin + if Assigned(_frmMenu) then + _frmMenu.Show + else + begin + _frmMenu := TMenuForm.Create(self); +// Application.AddForm(_frmMenu); + _frmMenu.Show; + end; + _frmMenu.SetPosition(Point(Left + Width + 5, FindForm.Top)); +end; + +procedure TMainForm.PanelBtnClick(Sender: TObject); +begin + if Assigned(_frmPanel) then + _frmPanel.Show + else + begin + _frmPanel := TPanelForm.Create(self); + _frmPanel.Show; + end; + _frmPanel.SetPosition(Point(Left + Width + 5, FindForm.Top)); +end; + +procedure TMainForm.ProgressBarBtnClick(Sender: TObject); +begin + if Assigned(_frmProgressBar) then + _frmProgressBar.Show + else + begin + _frmProgressBar := TProgressBarForm.Create(self); + _frmProgressBar.Show; + end; + _frmProgressBar.SetPosition(Point(Left + Width + 5, FindForm.Top)); +end; + + +// ------------------------------------------------------------------- +// TCheckBoxForm +// ------------------------------------------------------------------- + +procedure TCheckBoxForm.GrayCheckBoxClick(Sender: TObject); +begin + CheckBox1.Enabled := not GrayCheckBox.Checked; + CheckBox2.Enabled := not GrayCheckBox.Checked; +end; + + +// ------------------------------------------------------------------- +// TRadioButtonForm +// ------------------------------------------------------------------- + +procedure TRadioButtonForm.GrayCheckBoxClick(Sender: TObject); +begin + HorzBox.Enabled := not GrayCheckBox.Checked; +end; + + +// ------------------------------------------------------------------- +// TGroupBoxForm +// ------------------------------------------------------------------- + +procedure TGroupBoxForm.GrayCheckBoxClick(Sender: TObject); +begin + GroupBox2.Enabled := not GrayCheckBox.Checked; +end; + + +procedure TGroupBoxForm.ButtonClick(Sender: TObject); +begin + Radio1.Checked := True; + Button.Enabled := False; +end; + + +procedure TGroupBoxForm.RadioButtonClick(Sender: TObject); +begin + Button.Enabled := not Radio1.Checked; +end; + + +// ------------------------------------------------------------------- +// TEditForm +// ------------------------------------------------------------------- + +procedure TEditForm.GrayCheckBox1Click(Sender: TObject); +begin + Edit1.Enabled := not GrayCheckBox1.Checked; +end; + + +procedure TEditForm.GrayCheckBox2Click(Sender: TObject); +begin + Edit2.Enabled := not GrayCheckBox2.Checked; +end; + + +procedure TEditForm.Edit2Change(Sender: TObject); +begin + PasswordDisplay.Text := '(= ' + Edit2.Text + ')'; +end; + + +// ------------------------------------------------------------------- +// TScrollBarForm +// ------------------------------------------------------------------- + +procedure TScrollBarForm.GrayCheckBoxClick(Sender: TObject); +begin + HorzBox.Enabled := not GrayCheckBox.Checked; +end; + + +procedure TScrollBarForm.ScrollBar1Change(Sender: TObject); +begin + PosLabel1.Text := IntToStr(ScrollBar1.Position); +end; + + +procedure TScrollBarForm.ScrollBar2Change(Sender: TObject); +begin + PosLabel2.Text := IntToStr(ScrollBar2.Position); +end; + + +procedure TScrollBarForm.ScrollBar3Change(Sender: TObject); +begin + PosLabel3.Text := IntToStr(ScrollBar3.Position); +end; + + +procedure TScrollBarForm.ScrollBar4Change(Sender: TObject); +begin + PosLabel4.Text := IntToStr(ScrollBar4.Position); +end; + + +procedure TScrollBarForm.ScrollBar5Change(Sender: TObject); +begin + PosLabel5.Text := IntToStr(ScrollBar5.Position); +end; + + +// ------------------------------------------------------------------- +// TComboBoxForm +// ------------------------------------------------------------------- + +procedure TComboBoxForm.GrayCheckBoxClick(Sender: TObject); +begin + ComboBox1.Enabled := not GrayCheckBox.Checked; + ComboBox2.Enabled := not GrayCheckBox.Checked; +end; + + +procedure TComboBoxForm.FormCreate(Sender: TObject); +var + i: integer; +begin + for i := 1 to 20 do + begin + ComboBox1.Items.Add(Format('Item 1.%d...', [i])); + ComboBox2.Items.Add(Format('Item 2.%d...', [i])); + end; + BetaLabel.FontColor := clBlue; +end; + + +// ------------------------------------------------------------------- +// TGridForm +// ------------------------------------------------------------------- + +procedure TGridForm.FormCreate(Sender: TObject); +var + x, y: Integer; +begin + for y := 0 to StringGrid.RowCount - 1 do + for x := 0 to StringGrid.ColCount - 1 do + StringGrid.Cells[x, y] := Format('%d, %d', [x, y]); +end; + + +var + MainForm: TMainForm; +begin + MainForm := nil; + WriteLn('Version: ' + {$I %date%} + ' ' + {$I %time%}); + + Application.CreateForm(TMainForm, MainForm); + try + Application.Run; + finally + MainForm.Free; + end; +end. diff --git a/examples/img/Makefile b/examples/img/Makefile new file mode 100644 index 00000000..e799dc0f --- /dev/null +++ b/examples/img/Makefile @@ -0,0 +1,1313 @@ +# +# Makefile generated by fpcmake v1.00 [2001/01/01] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT or OS/2) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +# define inOS2 when running under OS/2 +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +PWD:=$(firstword $(PWD)) +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The extension of batch files / scripts +ifdef inUnix +BATCHEXT=.sh +else +ifdef inOS2 +BATCHEXT=.cmd +else +BATCHEXT=.bat +endif +endif + +# Path Separator, the subst trick is necessary for the \ that can't exists +# at the end of a line +ifdef inUnix +PATHSEP=/ +else +PATHSEP=$(subst /,\,/) +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override DIROBJECTS+=$(wildcard disp_bmp masktest) + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + + +# Directories + + +# Packages + + +# Libraries + + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +PPAS=ppas$(BATCHEXT) + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all $(addsuffix _all,$(DIROBJECTS)) + +debug: fpc_debug $(addsuffix _debug,$(DIROBJECTS)) + +smart: fpc_smart $(addsuffix _smart,$(DIROBJECTS)) + +shared: fpc_shared $(addsuffix _shared,$(DIROBJECTS)) + +showinstall: fpc_showinstall $(addsuffix _showinstall,$(DIROBJECTS)) + +install: fpc_install $(addsuffix _install,$(DIROBJECTS)) + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean $(addsuffix _clean,$(DIROBJECTS)) + +distclean: fpc_distclean $(addsuffix _distclean,$(DIROBJECTS)) + +cleanall: fpc_cleanall $(addsuffix _cleanall,$(DIROBJECTS)) + +require: $(addsuffix _require,$(DIROBJECTS)) + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall require info + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +PACKAGESUFFIX=emx +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +# Use a wrapper script by default for OS/2 +ifdef inOS2 +USEZIPWRAPPER=1 +endif + +# Create commands to create the zip/tar file +ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) +ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USETAR +ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * +else +ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(DEL) $(ZIPDESTFILE) +ifdef USEZIPWRAPPER +ifneq ($(ECHO),echo) + $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) + $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) + $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +else + $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) +endif +ifdef inUnix + /bin/sh $(ZIPWRAPPER) +else + $(ZIPWRAPPER) +endif + $(DEL) $(ZIPWRAPPER) +else + $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Directories +##################################################################### + +OBJECTDIRDISP_BMP=1 +OBJECTDIRMASKTEST=1 + +# Dir disp_bmp + +ifdef OBJECTDIRDISP_BMP +.PHONY: disp_bmp_all disp_bmp_debug disp_bmp_examples disp_bmp_test disp_bmp_smart disp_bmp_shared disp_bmp_showinstall disp_bmp_install disp_bmp_sourceinstall disp_bmp_exampleinstall disp_bmp_zipinstall disp_bmp_zipsourceinstall disp_bmp_zipexampleinstall disp_bmp_clean disp_bmp_distclean disp_bmp_cleanall disp_bmp_require disp_bmp_info + +disp_bmp_all: + $(MAKE) -C disp_bmp all + +disp_bmp_debug: + $(MAKE) -C disp_bmp debug + +disp_bmp_examples: + $(MAKE) -C disp_bmp examples + +disp_bmp_test: + $(MAKE) -C disp_bmp test + +disp_bmp_smart: + $(MAKE) -C disp_bmp smart + +disp_bmp_shared: + $(MAKE) -C disp_bmp shared + +disp_bmp_showinstall: + $(MAKE) -C disp_bmp showinstall + +disp_bmp_install: + $(MAKE) -C disp_bmp install + +disp_bmp_sourceinstall: + $(MAKE) -C disp_bmp sourceinstall + +disp_bmp_exampleinstall: + $(MAKE) -C disp_bmp exampleinstall + +disp_bmp_zipinstall: + $(MAKE) -C disp_bmp zipinstall + +disp_bmp_zipsourceinstall: + $(MAKE) -C disp_bmp zipsourceinstall + +disp_bmp_zipexampleinstall: + $(MAKE) -C disp_bmp zipexampleinstall + +disp_bmp_clean: + $(MAKE) -C disp_bmp clean + +disp_bmp_distclean: + $(MAKE) -C disp_bmp distclean + +disp_bmp_cleanall: + $(MAKE) -C disp_bmp cleanall + +disp_bmp_require: + $(MAKE) -C disp_bmp require + +disp_bmp_info: + $(MAKE) -C disp_bmp info +endif + +# Dir masktest + +ifdef OBJECTDIRMASKTEST +.PHONY: masktest_all masktest_debug masktest_examples masktest_test masktest_smart masktest_shared masktest_showinstall masktest_install masktest_sourceinstall masktest_exampleinstall masktest_zipinstall masktest_zipsourceinstall masktest_zipexampleinstall masktest_clean masktest_distclean masktest_cleanall masktest_require masktest_info + +masktest_all: + $(MAKE) -C masktest all + +masktest_debug: + $(MAKE) -C masktest debug + +masktest_examples: + $(MAKE) -C masktest examples + +masktest_test: + $(MAKE) -C masktest test + +masktest_smart: + $(MAKE) -C masktest smart + +masktest_shared: + $(MAKE) -C masktest shared + +masktest_showinstall: + $(MAKE) -C masktest showinstall + +masktest_install: + $(MAKE) -C masktest install + +masktest_sourceinstall: + $(MAKE) -C masktest sourceinstall + +masktest_exampleinstall: + $(MAKE) -C masktest exampleinstall + +masktest_zipinstall: + $(MAKE) -C masktest zipinstall + +masktest_zipsourceinstall: + $(MAKE) -C masktest zipsourceinstall + +masktest_zipexampleinstall: + $(MAKE) -C masktest zipexampleinstall + +masktest_clean: + $(MAKE) -C masktest clean + +masktest_distclean: + $(MAKE) -C masktest distclean + +masktest_cleanall: + $(MAKE) -C masktest cleanall + +masktest_require: + $(MAKE) -C masktest require + +masktest_info: + $(MAKE) -C masktest info +endif + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/examples/img/Makefile.fpc b/examples/img/Makefile.fpc new file mode 100644 index 00000000..9eb71ba2 --- /dev/null +++ b/examples/img/Makefile.fpc @@ -0,0 +1,6 @@ +# +# Makefile.fpc for fpImg examples +# + +[targets] +dirs=disp_bmp masktest diff --git a/examples/img/disp_bmp/Makefile b/examples/img/disp_bmp/Makefile new file mode 100644 index 00000000..688f1238 --- /dev/null +++ b/examples/img/disp_bmp/Makefile @@ -0,0 +1,1306 @@ +# +# Makefile generated by fpcmake v1.00 [2000/12/19] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT or OS/2) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +# define inOS2 when running under OS/2 +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +PWD:=$(firstword $(PWD)) +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Default FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR=../../../../fpc +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override EXEOBJECTS+=disp_bmp + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2h + +# Directories + +override NEEDUNITDIR=../../src + +# Packages + +override PACKAGES+=rtl fcl fpgfx + +# Libraries + + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +ifdef inUnix +PPAS=ppas.sh +else +ifdef inOS2 +PPAS=ppas.cmd +else +PPAS=ppas.bat +endif +endif + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 +PACKAGEFCL=1 +PACKAGEFPGFX=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef PACKAGEFCL +ifneq ($(wildcard $(FPCDIR)/fcl),) +ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) +PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) +else +PACKAGEDIR_FCL=$(FPCDIR)/fcl +endif +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +UNITDIR_FCL=$(PACKAGEDIR_FCL) +else +PACKAGEDIR_FCL= +ifneq ($(wildcard $(UNITSDIR)/fcl),) +ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) +UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) +else +UNITDIR_FCL=$(UNITSDIR)/fcl +endif +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override NEEDUNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef PACKAGEFPGFX +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx/$(OS_TARGET)),) +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx/$(OS_TARGET) +else +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +else +PACKAGEDIR_FPGFX= +ifneq ($(wildcard $(UNITSDIR)/fpgfx),) +ifneq ($(wildcard $(UNITSDIR)/fpgfx/$(OS_TARGET)),) +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx/$(OS_TARGET) +else +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx +endif +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override NEEDUNITDIR+=$(UNITDIR_FPGFX) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Exes +##################################################################### + +.PHONY: fpc_exes + +ifdef EXEOBJECTS +override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) + +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) + +endif + +fpc_exes: $(EXEFILES) + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +PACKAGESUFFIX=emx +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) +ifdef USETAR + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) + cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR) +else + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) + cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/examples/img/disp_bmp/Makefile.fpc b/examples/img/disp_bmp/Makefile.fpc new file mode 100644 index 00000000..a4b5ccbb --- /dev/null +++ b/examples/img/disp_bmp/Makefile.fpc @@ -0,0 +1,14 @@ +# +# Makefile.fpc for fpImg example "disp_bmp" +# + +[targets] +programs=disp_bmp + +[require] +options=-S2h +packages=fcl fpgfx + +[dirs] +fpcdir=../../../../fpc +unitdir=../../src diff --git a/examples/img/disp_bmp/disp_bmp.pas b/examples/img/disp_bmp/disp_bmp.pas new file mode 100644 index 00000000..a33bf9be --- /dev/null +++ b/examples/img/disp_bmp/disp_bmp.pas @@ -0,0 +1,90 @@ +{ + $Id: disp_bmp.pp,v 1.6 2001/02/14 23:08:59 sg Exp $ + + fpImg - Free Pascal Imaging Library + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + + Example: Display BMP file + + See the file COPYING, included in this distribution, + for details about the copyright. + + 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. +} + + +program Disp_BMP; + +uses Classes, GFXBase, GFXImpl, fpImg, BMPReader; + +type + TMainWindow = class + procedure Paint(Sender: TObject; const Rect: TRect); + private + Display: TDefDisplay; + Window: TGfxWindow; + Image: TGfxImage; + public + constructor Create(ADisplay: TDefDisplay); + destructor Destroy; override; + end; + +constructor TMainWindow.Create(ADisplay: TDefDisplay); +begin + inherited Create; + Display := ADisplay; + Image := CreateImageFromFile(Display.DefaultScreen, TBMPReader, ParamStr(1)); + Window := ADisplay.DefaultScreen.CreateWindow; + Window.Title := 'fpImg Bitmap Test'; + Window.OnPaint := @Paint; + Window.SetFixedClientSize(Size(Image.Width, Image.Height)); + Window.Show; +end; + +destructor TMainWindow.Destroy; +begin + Image.Free; + inherited Destroy; +end; + +procedure TMainWindow.Paint(Sender: TObject; const Rect: TRect); +begin + Window.Canvas.SetColor(colRed); + Window.Canvas.FillRect(Rect); + Window.Canvas.SetColor(colYellow); + Window.Canvas.DrawImage(Image, Point(0, 0)); +end; + +var + Display: TDefDisplay; + MainWindow: TMainWindow; +begin + if ParamCount <> 1 then + begin + WriteLn(StdErr, 'Please give the name of a BMP file as argument'); + Halt(2); + end; + + Display := TDefDisplay.Create; + MainWindow := TMainWindow.Create(Display); + Display.Run; + MainWindow.Free; + Display.Free; +end. + + +{ + $Log: disp_bmp.pp,v $ + Revision 1.6 2001/02/14 23:08:59 sg + * Adapted to changes in fpGFX interface + + Revision 1.5 2001/02/09 20:49:03 sg + * Adapted to recent improvements in fpGFX interfaces + + Revision 1.4 2001/01/11 23:21:53 sg + *** empty log message *** + +} diff --git a/examples/img/disp_bmp/test.bmp b/examples/img/disp_bmp/test.bmp Binary files differnew file mode 100644 index 00000000..bda7377d --- /dev/null +++ b/examples/img/disp_bmp/test.bmp diff --git a/examples/img/disp_bmp/test2.bmp b/examples/img/disp_bmp/test2.bmp Binary files differnew file mode 100644 index 00000000..13d6323e --- /dev/null +++ b/examples/img/disp_bmp/test2.bmp diff --git a/examples/img/disp_bmp/test4.bmp b/examples/img/disp_bmp/test4.bmp Binary files differnew file mode 100644 index 00000000..4fd4a9db --- /dev/null +++ b/examples/img/disp_bmp/test4.bmp diff --git a/examples/img/disp_bmp/test8.bmp b/examples/img/disp_bmp/test8.bmp Binary files differnew file mode 100644 index 00000000..47fc32e6 --- /dev/null +++ b/examples/img/disp_bmp/test8.bmp diff --git a/examples/img/masktest/Makefile b/examples/img/masktest/Makefile new file mode 100644 index 00000000..4ce21577 --- /dev/null +++ b/examples/img/masktest/Makefile @@ -0,0 +1,1347 @@ +# +# Makefile generated by fpcmake v1.00 [2001/01/01] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT or OS/2) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +# define inOS2 when running under OS/2 +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +PWD:=$(firstword $(PWD)) +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The extension of batch files / scripts +ifdef inUnix +BATCHEXT=.sh +else +ifdef inOS2 +BATCHEXT=.cmd +else +BATCHEXT=.bat +endif +endif + +# Path Separator, the subst trick is necessary for the \ that can't exists +# at the end of a line +ifdef inUnix +PATHSEP=/ +else +PATHSEP=$(subst /,\,/) +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Default FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR=../../../../fpc +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override EXEOBJECTS+=masktest + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2h + +# Directories + +override NEEDUNITDIR=../../src + +# Packages + +override PACKAGES+=rtl fcl fpgfx + +# Libraries + + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +PPAS=ppas$(BATCHEXT) + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 +PACKAGEFCL=1 +PACKAGEFPGFX=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef PACKAGEFCL +ifneq ($(wildcard $(FPCDIR)/fcl),) +ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) +PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) +else +PACKAGEDIR_FCL=$(FPCDIR)/fcl +endif +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +UNITDIR_FCL=$(PACKAGEDIR_FCL) +else +PACKAGEDIR_FCL= +ifneq ($(wildcard $(UNITSDIR)/fcl),) +ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) +UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) +else +UNITDIR_FCL=$(UNITSDIR)/fcl +endif +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override NEEDUNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef PACKAGEFPGFX +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx/$(OS_TARGET)),) +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx/$(OS_TARGET) +else +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +else +PACKAGEDIR_FPGFX= +ifneq ($(wildcard $(UNITSDIR)/fpgfx),) +ifneq ($(wildcard $(UNITSDIR)/fpgfx/$(OS_TARGET)),) +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx/$(OS_TARGET) +else +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx +endif +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override NEEDUNITDIR+=$(UNITDIR_FPGFX) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Exes +##################################################################### + +.PHONY: fpc_exes + +ifdef EXEOBJECTS +override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS)) +override EXEOFILES:=$(addsuffix $(OEXT),$(EXEOBJECTS)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(EXEOBJECTS))) + +override ALLTARGET+=fpc_exes +override INSTALLEXEFILES+=$(EXEFILES) +override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES) + +endif + +fpc_exes: $(EXEFILES) + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +PACKAGESUFFIX=emx +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +# Use a wrapper script by default for OS/2 +ifdef inOS2 +USEZIPWRAPPER=1 +endif + +# Create commands to create the zip/tar file +ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) +ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USETAR +ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * +else +ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(DEL) $(ZIPDESTFILE) +ifdef USEZIPWRAPPER +ifneq ($(ECHO),echo) + $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) + $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) + $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +else + $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) +endif +ifdef inUnix + /bin/sh $(ZIPWRAPPER) +else + $(ZIPWRAPPER) +endif + $(DEL) $(ZIPWRAPPER) +else + $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/examples/img/masktest/Makefile.fpc b/examples/img/masktest/Makefile.fpc new file mode 100644 index 00000000..5151e7a3 --- /dev/null +++ b/examples/img/masktest/Makefile.fpc @@ -0,0 +1,14 @@ +# +# Makefile.fpc for fpImg example "masktest" +# + +[targets] +programs=masktest + +[require] +options=-S2h +packages=fcl fpgfx + +[dirs] +fpcdir=../../../../fpc +unitdir=../../src diff --git a/examples/img/masktest/image2.bmp b/examples/img/masktest/image2.bmp Binary files differnew file mode 100644 index 00000000..8e08ff44 --- /dev/null +++ b/examples/img/masktest/image2.bmp diff --git a/examples/img/masktest/image24.bmp b/examples/img/masktest/image24.bmp Binary files differnew file mode 100644 index 00000000..8c4f248d --- /dev/null +++ b/examples/img/masktest/image24.bmp diff --git a/examples/img/masktest/image4.bmp b/examples/img/masktest/image4.bmp Binary files differnew file mode 100644 index 00000000..c57697ba --- /dev/null +++ b/examples/img/masktest/image4.bmp diff --git a/examples/img/masktest/image8.bmp b/examples/img/masktest/image8.bmp Binary files differnew file mode 100644 index 00000000..85d08b9f --- /dev/null +++ b/examples/img/masktest/image8.bmp diff --git a/examples/img/masktest/mask.bmp b/examples/img/masktest/mask.bmp Binary files differnew file mode 100644 index 00000000..7cc016e5 --- /dev/null +++ b/examples/img/masktest/mask.bmp diff --git a/examples/img/masktest/masktest.pas b/examples/img/masktest/masktest.pas new file mode 100644 index 00000000..2539bf07 --- /dev/null +++ b/examples/img/masktest/masktest.pas @@ -0,0 +1,150 @@ +{ + $Id: masktest.pp,v 1.3 2001/02/14 23:08:59 sg Exp $ + + fpImg - Free Pascal Imaging Library + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + + Example: Display BMP file with monochrome mask + + See the file COPYING, included in this distribution, + for details about the copyright. + + 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. +} + + +program MaskTest; + +uses Classes, GFXBase, GFXImpl, fpImg, BMPReader; + +type + TMainWindow = class + procedure Paint(Sender: TObject; const ARect: TRect); + private + Display: TDefDisplay; + Window: TGfxWindow; + Image2, Image4, Image8, Image24, Mask: TGfxImage; + Image2Canvas, Image4Canvas, Image8Canvas, + Image24Canvas, MaskCanvas: TGfxCanvas; + public + constructor Create(ADisplay: TDefDisplay); + destructor Destroy; override; + end; + +constructor TMainWindow.Create(ADisplay: TDefDisplay); +begin + inherited Create; + Display := ADisplay; + + // Load and prepare the images + Image2 := CreateImageFromFile(Display.DefaultScreen, TBMPReader, 'image2.bmp'); + Image2Canvas := + Display.DefaultScreen.CreateBitmap(Image2.Width, Image2.Height); + Image2Canvas.DrawImage(Image2, Point(0, 0)); + + Image4 := CreateImageFromFile(Display.DefaultScreen, TBMPReader, 'image4.bmp'); + Image4Canvas := + Display.DefaultScreen.CreateBitmap(Image4.Width, Image4.Height); + Image4Canvas.DrawImage(Image4, Point(0, 0)); + + Image8 := CreateImageFromFile(Display.DefaultScreen, TBMPReader, 'image8.bmp'); + Image8Canvas := + Display.DefaultScreen.CreateBitmap(Image8.Width, Image8.Height); + Image8Canvas.DrawImage(Image8, Point(0, 0)); + + Image24 := CreateImageFromFile(Display.DefaultScreen, TBMPReader, 'image24.bmp'); + Image24Canvas := + Display.DefaultScreen.CreateBitmap(Image24.Width, Image24.Height); + Image24Canvas.DrawImage(Image24, Point(0, 0)); + + // Load and prepare the image mask + Mask := CreateImageFromFile(Display.DefaultScreen, TBMPReader, 'mask.bmp'); + MaskCanvas := Display.DefaultScreen.CreateMonoBitmap(Mask.Width, Mask.Height); + MaskCanvas.DrawImage(Mask, Point(0, 0)); + + Window := ADisplay.DefaultScreen.CreateWindow; + Window.Title := 'fpImg Blitting Mask Test'; + Window.OnPaint := @Paint; + Window.SetClientSize(Size(Image2.Width * 2 + 64, Image2.Height * 2 + 64)); + Window.Show; +end; + +destructor TMainWindow.Destroy; +begin + MaskCanvas.Free; + Mask.Free; + Image24Canvas.Free; + Image24.Free; + Image8Canvas.Free; + Image8.Free; + Image4Canvas.Free; + Image4.Free; + Image2Canvas.Free; + Image2.Free; + inherited Destroy; +end; + +procedure TMainWindow.Paint(Sender: TObject; const ARect: TRect); +var + Color: TGfxColor; + r: TRect; + i, x1, y1, x2, y2: Integer; +begin + Color.Red := 0; + Color.Green := 0; + Color.Alpha := 0; + r.Left := ARect.Left; + r.Right := ARect.Right; + for i := ARect.Top to ARect.Bottom - 1 do + begin + Color.Blue := $ffff - (i * $ffff) div Window.Height; + Color.Red := Color.Blue shr 1; + Window.Canvas.SetColor(Color); + r.Top := i; + r.Bottom := i + 1; + Window.Canvas.FillRect(r); + end; + + x1 := Window.ClientWidth div 4 - Image2.Width div 2; + y1 := Window.ClientHeight div 4 - Image2.Height div 2; + x2 := x1 + Window.ClientWidth div 2; + y2 := y1 + Window.ClientHeight div 2; + + Window.Canvas.MaskedCopy(Image2Canvas, MaskCanvas, Point(x1, y1)); + Window.Canvas.TextOut(Point(x1, y1 + Image2.Height), 'monochrome'); + Window.Canvas.MaskedCopy(Image4Canvas, MaskCanvas, Point(x2, y1)); + Window.Canvas.TextOut(Point(x2, y1 + Image2.Height), '4bpp palettized'); + Window.Canvas.MaskedCopy(Image8Canvas, MaskCanvas, Point(x1, y2)); + Window.Canvas.TextOut(Point(x1, y2 + Image2.Height), '8bpp palettized'); + Window.Canvas.MaskedCopy(Image24Canvas, MaskCanvas, Point(x2, y2)); + Window.Canvas.TextOut(Point(x2, y2 + Image2.Height), '24bpp true color'); +end; + +var + Display: TDefDisplay; + MainWindow: TMainWindow; +begin +WriteLn('Version: ' + {$I %date%} + ' ' + {$I %time%}); + Display := TDefDisplay.Create; + MainWindow := TMainWindow.Create(Display); + Display.Run; + MainWindow.Free; + Display.Free; +end. + + +{ + $Log: masktest.pp,v $ + Revision 1.3 2001/02/14 23:08:59 sg + * Adapted to changes in fpGFX interface + + Revision 1.2 2001/02/09 20:49:03 sg + * Adapted to recent improvements in fpGFX interfaces + + Revision 1.1 2001/01/11 23:21:53 sg + *** empty log message *** + +} diff --git a/gfx/Makefile b/gfx/Makefile new file mode 100644 index 00000000..9d7a373b --- /dev/null +++ b/gfx/Makefile @@ -0,0 +1,2041 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/08/28] +# +default: all +MAKEFILETARGETS=i386-linux +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=/opt/fpc/src +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +FPC:=$(shell $(FPCPROG) -PB) +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +FOUNDFPC:=$(strip $(wildcard $(FPC))) +ifeq ($(FOUNDFPC),) +FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))) +ifeq ($(FOUNDFPC),) +$(error Compiler $(FPC) not found) +endif +endif +ifndef FPC_COMPILERINFO +FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO) +endif +ifndef FPC_VERSION +FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO)) +endif +export FPC FPC_VERSION FPC_COMPILERINFO +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +OS_TARGET:=$(word 5,$(FPC_COMPILERINFO)) +endif +FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +TARGETSUFFIX=$(OS_TARGET) +SOURCESUFFIX=$(OS_SOURCE) +else +TARGETSUFFIX=$(FULL_TARGET) +SOURCESUFFIX=$(FULL_SOURCE) +endif +ifneq ($(FULL_TARGET),$(FULL_SOURCE)) +CROSSCOMPILE=1 +endif +ifeq ($(findstring makefile,$(MAKECMDGOALS)),) +ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +override PACKAGE_NAME=fpgfx +override PACKAGE_VERSION=0.2 +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_DIRS+=linux +endif +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_UNITS+=gfxbase geldirty gelimage +endif +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_RSTS+=gfxbase +endif +override INSTALL_BUILDUNIT=gfxbase +override INSTALL_FPCPACKAGE=y +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_OPTIONS+=-S2h +endif +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_SOURCEDIR+=emulayer +endif +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_UNITTARGETDIR+=units +endif +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef COMPILER_UNITTARGETDIR +ifdef PACKAGEDIR_MAIN +COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX) +else +COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX) +endif +endif +ifndef COMPILER_TARGETDIR +COMPILER_TARGETDIR=. +endif +ifndef INSTALL_BASEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +ifdef CROSSCOMPILE +ifdef CROSSINSTALL +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX) +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +endif +endif +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +endif +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +FPCMADE=fpcmade.$(SHORTSUFFIX) +ZIPSUFFIX=$(SHORTSUFFIX) +ZIPCROSSPREFIX= +ZIPSOURCESUFFIX=src +ZIPEXAMPLESUFFIX=exm +else +FPCMADE=fpcmade.$(TARGETSUFFIX) +ZIPSOURCESUFFIX=.source +ZIPEXAMPLESUFFIX=.examples +ifdef CROSSCOMPILE +ZIPSUFFIX=.$(SOURCESUFFIX) +ZIPCROSSPREFIX=$(TARGETSUFFIX)- +else +ZIPSUFFIX=.$(TARGETSUFFIX) +ZIPCROSSPREFIX= +endif +endif +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= __missing_command_MVPROG +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef MKDIRPROG +MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG= __missing_command_MKDIRPROG +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +endif +export MKDIRPROG +ifndef ECHOREDIR +ifndef inUnix +ECHOREDIR=echo +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= __missing_command_PPUMOVE +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl fcl +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_NETDB=1 +REQUIRE_PACKAGES_LIBASYNC=1 +REQUIRE_PACKAGES_PTHREADS=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_PASJPEG=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_POSTGRES=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_ODBC=1 +REQUIRE_PACKAGES_ORACLE=1 +REQUIRE_PACKAGES_SQLITE=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_RTL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE) +endif +else +PACKAGEDIR_RTL= +UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_RTL),) +UNITDIR_RTL:=$(firstword $(UNITDIR_RTL)) +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override COMPILER_UNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef REQUIRE_PACKAGES_HASH +PACKAGEDIR_HASH:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /hash/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_HASH),) +ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)),) +UNITDIR_HASH=$(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX) +else +UNITDIR_HASH=$(PACKAGEDIR_HASH) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_HASH)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_HASH) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_HASH)/$(FPCMADE) +endif +else +PACKAGEDIR_HASH= +UNITDIR_HASH:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /hash/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_HASH),) +UNITDIR_HASH:=$(firstword $(UNITDIR_HASH)) +else +UNITDIR_HASH= +endif +endif +ifdef UNITDIR_HASH +override COMPILER_UNITDIR+=$(UNITDIR_HASH) +endif +endif +ifdef REQUIRE_PACKAGES_PASZLIB +PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PASZLIB)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PASZLIB) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PASZLIB)/$(FPCMADE) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_NETDB +PACKAGEDIR_NETDB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /netdb/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_NETDB),) +ifneq ($(wildcard $(PACKAGEDIR_NETDB)/units/$(TARGETSUFFIX)),) +UNITDIR_NETDB=$(PACKAGEDIR_NETDB)/units/$(TARGETSUFFIX) +else +UNITDIR_NETDB=$(PACKAGEDIR_NETDB) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_NETDB)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_NETDB) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_NETDB)/$(FPCMADE) +endif +else +PACKAGEDIR_NETDB= +UNITDIR_NETDB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /netdb/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_NETDB),) +UNITDIR_NETDB:=$(firstword $(UNITDIR_NETDB)) +else +UNITDIR_NETDB= +endif +endif +ifdef UNITDIR_NETDB +override COMPILER_UNITDIR+=$(UNITDIR_NETDB) +endif +endif +ifdef REQUIRE_PACKAGES_LIBASYNC +PACKAGEDIR_LIBASYNC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /libasync/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_LIBASYNC),) +ifneq ($(wildcard $(PACKAGEDIR_LIBASYNC)/units/$(TARGETSUFFIX)),) +UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC)/units/$(TARGETSUFFIX) +else +UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_LIBASYNC)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_LIBASYNC) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_LIBASYNC)/$(FPCMADE) +endif +else +PACKAGEDIR_LIBASYNC= +UNITDIR_LIBASYNC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /libasync/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_LIBASYNC),) +UNITDIR_LIBASYNC:=$(firstword $(UNITDIR_LIBASYNC)) +else +UNITDIR_LIBASYNC= +endif +endif +ifdef UNITDIR_LIBASYNC +override COMPILER_UNITDIR+=$(UNITDIR_LIBASYNC) +endif +endif +ifdef REQUIRE_PACKAGES_PTHREADS +PACKAGEDIR_PTHREADS:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pthreads/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_PTHREADS),) +ifneq ($(wildcard $(PACKAGEDIR_PTHREADS)/units/$(TARGETSUFFIX)),) +UNITDIR_PTHREADS=$(PACKAGEDIR_PTHREADS)/units/$(TARGETSUFFIX) +else +UNITDIR_PTHREADS=$(PACKAGEDIR_PTHREADS) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PTHREADS)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PTHREADS) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PTHREADS)/$(FPCMADE) +endif +else +PACKAGEDIR_PTHREADS= +UNITDIR_PTHREADS:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /pthreads/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PTHREADS),) +UNITDIR_PTHREADS:=$(firstword $(UNITDIR_PTHREADS)) +else +UNITDIR_PTHREADS= +endif +endif +ifdef UNITDIR_PTHREADS +override COMPILER_UNITDIR+=$(UNITDIR_PTHREADS) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_FCL),) +ifneq ($(wildcard $(PACKAGEDIR_FCL)/units/$(TARGETSUFFIX)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/units/$(TARGETSUFFIX) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_FCL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_FCL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL)/$(FPCMADE) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_PASJPEG +PACKAGEDIR_PASJPEG:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pasjpeg/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_PASJPEG),) +ifneq ($(wildcard $(PACKAGEDIR_PASJPEG)/units/$(TARGETSUFFIX)),) +UNITDIR_PASJPEG=$(PACKAGEDIR_PASJPEG)/units/$(TARGETSUFFIX) +else +UNITDIR_PASJPEG=$(PACKAGEDIR_PASJPEG) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PASJPEG)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PASJPEG) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PASJPEG)/$(FPCMADE) +endif +else +PACKAGEDIR_PASJPEG= +UNITDIR_PASJPEG:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /pasjpeg/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASJPEG),) +UNITDIR_PASJPEG:=$(firstword $(UNITDIR_PASJPEG)) +else +UNITDIR_PASJPEG= +endif +endif +ifdef UNITDIR_PASJPEG +override COMPILER_UNITDIR+=$(UNITDIR_PASJPEG) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_IBASE),) +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/units/$(TARGETSUFFIX)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/units/$(TARGETSUFFIX) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_IBASE)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_IBASE) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_IBASE)/$(FPCMADE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +ifdef REQUIRE_PACKAGES_POSTGRES +PACKAGEDIR_POSTGRES:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /postgres/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_POSTGRES),) +ifneq ($(wildcard $(PACKAGEDIR_POSTGRES)/units/$(TARGETSUFFIX)),) +UNITDIR_POSTGRES=$(PACKAGEDIR_POSTGRES)/units/$(TARGETSUFFIX) +else +UNITDIR_POSTGRES=$(PACKAGEDIR_POSTGRES) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_POSTGRES)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_POSTGRES) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_POSTGRES)/$(FPCMADE) +endif +else +PACKAGEDIR_POSTGRES= +UNITDIR_POSTGRES:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /postgres/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_POSTGRES),) +UNITDIR_POSTGRES:=$(firstword $(UNITDIR_POSTGRES)) +else +UNITDIR_POSTGRES= +endif +endif +ifdef UNITDIR_POSTGRES +override COMPILER_UNITDIR+=$(UNITDIR_POSTGRES) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_MYSQL),) +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/units/$(TARGETSUFFIX)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/units/$(TARGETSUFFIX) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_MYSQL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_MYSQL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_MYSQL)/$(FPCMADE) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_ODBC +PACKAGEDIR_ODBC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /odbc/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_ODBC),) +ifneq ($(wildcard $(PACKAGEDIR_ODBC)/units/$(TARGETSUFFIX)),) +UNITDIR_ODBC=$(PACKAGEDIR_ODBC)/units/$(TARGETSUFFIX) +else +UNITDIR_ODBC=$(PACKAGEDIR_ODBC) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_ODBC)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_ODBC) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_ODBC)/$(FPCMADE) +endif +else +PACKAGEDIR_ODBC= +UNITDIR_ODBC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /odbc/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_ODBC),) +UNITDIR_ODBC:=$(firstword $(UNITDIR_ODBC)) +else +UNITDIR_ODBC= +endif +endif +ifdef UNITDIR_ODBC +override COMPILER_UNITDIR+=$(UNITDIR_ODBC) +endif +endif +ifdef REQUIRE_PACKAGES_ORACLE +PACKAGEDIR_ORACLE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /oracle/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_ORACLE),) +ifneq ($(wildcard $(PACKAGEDIR_ORACLE)/units/$(TARGETSUFFIX)),) +UNITDIR_ORACLE=$(PACKAGEDIR_ORACLE)/units/$(TARGETSUFFIX) +else +UNITDIR_ORACLE=$(PACKAGEDIR_ORACLE) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_ORACLE)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_ORACLE) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_ORACLE)/$(FPCMADE) +endif +else +PACKAGEDIR_ORACLE= +UNITDIR_ORACLE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /oracle/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_ORACLE),) +UNITDIR_ORACLE:=$(firstword $(UNITDIR_ORACLE)) +else +UNITDIR_ORACLE= +endif +endif +ifdef UNITDIR_ORACLE +override COMPILER_UNITDIR+=$(UNITDIR_ORACLE) +endif +endif +ifdef REQUIRE_PACKAGES_SQLITE +PACKAGEDIR_SQLITE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /sqlite/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_SQLITE),) +ifneq ($(wildcard $(PACKAGEDIR_SQLITE)/units/$(TARGETSUFFIX)),) +UNITDIR_SQLITE=$(PACKAGEDIR_SQLITE)/units/$(TARGETSUFFIX) +else +UNITDIR_SQLITE=$(PACKAGEDIR_SQLITE) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_SQLITE)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_SQLITE) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_SQLITE)/$(FPCMADE) +endif +else +PACKAGEDIR_SQLITE= +UNITDIR_SQLITE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /sqlite/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_SQLITE),) +UNITDIR_SQLITE:=$(firstword $(UNITDIR_SQLITE)) +else +UNITDIR_SQLITE= +endif +endif +ifdef UNITDIR_SQLITE +override COMPILER_UNITDIR+=$(UNITDIR_SQLITE) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O1r +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif +.PHONY: fpc_units +ifneq ($(TARGET_UNITS),) +override ALLTARGET+=fpc_units +override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS)) +override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS)) +override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES) +override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES) +endif +fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/../fpc-pack +else +PACKDIR=/tmp/fpc-pack +endif +endif +ifndef ZIPNAME +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(PACKAGE_NAME) +endif +endif +ifndef FULLZIPNAME +FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX) +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install +endif +endif +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif +ifndef inUnix +USEZIPWRAPPER=1 +endif +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) +ifdef USETAR +ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT) +ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * +else +ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +endif +fpc_zipinstall: + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 + $(MKDIR) $(DIST_DESTDIR) + $(DEL) $(ZIPDESTFILE) +ifdef USEZIPWRAPPER +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) +else + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) +endif +ifdef inUnix + /bin/sh $(ZIPWRAPPER) +else + $(ZIPWRAPPER) +endif + $(DEL) $(ZIPWRAPPER) +else + $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) +endif + $(DELTREE) $(PACKDIR) +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX) +fpc_zipexampleinstall: +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX) +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +fpc_cleanall: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef COMPILER_UNITTARGETDIR +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +endif + -$(DELTREE) units + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) +ifneq ($(PPUEXT),.ppu) + -$(DEL) *.o *.ppu *.a +endif + -$(DELTREE) *$(SMARTEXT) + -$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(ECHO) Target OS.... $(OS_TARGET) + @$(ECHO) Full Source.. $(FULL_SOURCE) + @$(ECHO) Full Target.. $(FULL_TARGET) + @$(ECHO) SourceSuffix. $(SOURCESUFFIX) + @$(ECHO) TargetSuffix. $(TARGETSUFFIX) + @$(ECHO) + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) + @$(ECHO) DateStr.............. $(DATESTR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipCrossPrefix....... $(ZIPCROSSPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) FullZipName.......... $(FULLZIPNAME) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) + @$(ECHO) + @$(ECHO) Install base dir..... $(INSTALL_BASEDIR) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +ifeq ($(FULL_TARGET),i386-linux) +TARGET_DIRS_LINUX=1 +endif +ifdef TARGET_DIRS_LINUX +linux_all: + $(MAKE) -C linux all +linux_debug: + $(MAKE) -C linux debug +linux_smart: + $(MAKE) -C linux smart +linux_release: + $(MAKE) -C linux release +linux_units: + $(MAKE) -C linux units +linux_examples: + $(MAKE) -C linux examples +linux_shared: + $(MAKE) -C linux shared +linux_install: + $(MAKE) -C linux install +linux_sourceinstall: + $(MAKE) -C linux sourceinstall +linux_exampleinstall: + $(MAKE) -C linux exampleinstall +linux_distinstall: + $(MAKE) -C linux distinstall +linux_zipinstall: + $(MAKE) -C linux zipinstall +linux_zipsourceinstall: + $(MAKE) -C linux zipsourceinstall +linux_zipexampleinstall: + $(MAKE) -C linux zipexampleinstall +linux_zipdistinstall: + $(MAKE) -C linux zipdistinstall +linux_clean: + $(MAKE) -C linux clean +linux_distclean: + $(MAKE) -C linux distclean +linux_cleanall: + $(MAKE) -C linux cleanall +linux_info: + $(MAKE) -C linux info +linux_makefiles: + $(MAKE) -C linux makefiles +linux: + $(MAKE) -C linux all +.PHONY: linux_all linux_debug linux_smart linux_release linux_units linux_examples linux_shared linux_install linux_sourceinstall linux_exampleinstall linux_distinstall linux_zipinstall linux_zipsourceinstall linux_zipexampleinstall linux_zipdistinstall linux_clean linux_distclean linux_cleanall linux_info linux_makefiles linux +endif +all: fpc_all $(addsuffix _all,$(TARGET_DIRS)) +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units $(addsuffix _units,$(TARGET_DIRS)) +examples: $(addsuffix _examples,$(TARGET_DIRS)) +shared: fpc_shared +install: fpc_install $(addsuffix _install,$(TARGET_DIRS)) +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall $(addsuffix _exampleinstall,$(TARGET_DIRS)) +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall $(addsuffix _zipexampleinstall,$(TARGET_DIRS)) +zipdistinstall: fpc_zipdistinstall +clean: fpc_clean $(addsuffix _clean,$(TARGET_DIRS)) +distclean: fpc_distclean $(addsuffix _distclean,$(TARGET_DIRS)) +cleanall: fpc_cleanall $(addsuffix _cleanall,$(TARGET_DIRS)) +info: fpc_info +makefiles: fpc_makefiles +.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif +fpgui$(PPUEXT): $(wildcard *.pp *.inc) diff --git a/gfx/Makefile.fpc b/gfx/Makefile.fpc new file mode 100644 index 00000000..db5bf047 --- /dev/null +++ b/gfx/Makefile.fpc @@ -0,0 +1,37 @@ +# +# Makefile.fpc for fpGFX +# + +[package] +name=fpgfx +version=0.3 + +[require] +packages=fcl + +[target] +units=gfxbase geldirty gelimage +rsts=gfxbase +dirs_linux=linux +dirs_freebsd=linux +dirs_netbsd=linux +dirs_win32=win32 + +[compiler] +sourcedir=emulayer +unittargetdir=units +options=-S2h + +[install] +buildunit=gfxbase +fpcpackage=y + +[default] +fpcdir=/opt/fpc/src + +[rules] +fpgfx$(PPUEXT): $(wildcard *.pas *.inc) + +[libs] +libname=libfpgfx.so +libversion=0.3 diff --git a/gfx/emulayer/geldirty.pas b/gfx/emulayer/geldirty.pas new file mode 100644 index 00000000..1015f196 --- /dev/null +++ b/gfx/emulayer/geldirty.pas @@ -0,0 +1,195 @@ +{ + fpGFX - Free Pascal Graphics Library + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGFX development team. + + Window dirty list (redrawing queue) + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + +unit GELDirty; + +{$IFDEF Debug} + {$ASSERTIONS On} +{$ENDIF} +{$mode objfpc}{$H+} + +interface +uses + Classes, + GfxBase; // fpGFX units + + +type + + PDirtyListEntry = ^TDirtyListEntry; + TDirtyListEntry = record + Prev, Next: PDirtyListEntry; + Window: TFCustomWindow; + Rect: TRect; + end; + + + TDirtyList = class + private + FFirst, FLast: PDirtyListEntry; + protected + procedure RemoveEntry(AEntry: PDirtyListEntry); + public + destructor Destroy; override; + procedure AddRect(AWindow: TFCustomWindow; const ARect: TRect); + procedure ClearQueueForWindow(AWindow: TFCustomWindow); + procedure PaintQueueForWindow(AWindow: TFCustomWindow); + procedure PaintAll; + property First: PDirtyListEntry read FFirst write FFirst; // !!! + end; + + +implementation + + +destructor TDirtyList.Destroy; +var + Entry, NextEntry: PDirtyListEntry; +begin + Entry := FFirst; + while Assigned(Entry) do + begin + NextEntry := Entry^.Next; + Dispose(Entry); + Entry := NextEntry; + end; + inherited Destroy; +end; + + +procedure TDirtyList.AddRect(AWindow: TFCustomWindow; const ARect: TRect); +var + Entry, NextEntry: PDirtyListEntry; +begin + // Check for empty or invalid update rectangle + if (ARect.Left >= ARect.Right) or (ARect.Top >= ARect.Bottom) or + (ARect.Right < 0) or (ARect.Top < 0) or + (ARect.Left >= AWindow.ClientWidth) or + (ARect.Top >= AWindow.ClientHeight) then + exit; + + { Check if the new rectangle is already contained in some other rectangle + in the dirty list for the same window } + Entry := FFirst; + while Assigned(Entry) do + begin + NextEntry := Entry^.Next; + with Entry^.Rect do + if AWindow = Entry^.Window then + if (ARect.Left >= Left) and (ARect.Top >= Top) and + (ARect.Right <= Right) and (ARect.Bottom <= Bottom) then + // Rectangle is already contained in dirt list -> do nothing + exit + else if (Left >= ARect.Left) and (Top >= ARect.Top) and + (Right <= ARect.Right) and (Bottom <= ARect.Bottom) then + begin + // The new rectangle contains the currently checked rectangle + Entry^.Rect := ARect; + exit; + end; + Entry := NextEntry; + end; + + + // If we got this far, then we really have to add the rectangle to our list + + New(Entry); + Entry^.Window := AWindow; + Entry^.Rect := ARect; + Entry^.Next := nil; + + if Assigned(FFirst) then + begin + Entry^.Prev := FLast; + FLast^.Next := Entry; + FLast := Entry; + end else + begin + Entry^.Prev := nil; + FFirst := Entry; + FLast := Entry; + end; +end; + + +procedure TDirtyList.ClearQueueForWindow(AWindow: TFCustomWindow); +var + Entry, NextEntry: PDirtyListEntry; +begin + Entry := FFirst; + while Assigned(Entry) do + begin + NextEntry := Entry^.Next; + if Entry^.Window = AWindow then + RemoveEntry(Entry); + Entry := NextEntry; + end; +end; + + +procedure TDirtyList.PaintQueueForWindow(AWindow: TFCustomWindow); +var + IsNotEmpty: Boolean; + Entry, NextEntry: PDirtyListEntry; +begin + IsNotEmpty := False; + AWindow.Canvas.SaveState; + AWindow.Canvas.EmptyClipRect; + + Entry := First; + while Assigned(Entry) do + begin + NextEntry := Entry^.Next; + if Entry^.Window = AWindow then + begin + IsNotEmpty := AWindow.Canvas.UnionClipRect(Entry^.Rect); + RemoveEntry(Entry); + end; + Entry := NextEntry; + end; + + if IsNotEmpty and Assigned(AWindow.OnPaint) then + AWindow.OnPaint(AWindow, AWindow.Canvas.GetClipRect); + + AWindow.Canvas.RestoreState; +end; + + +procedure TDirtyList.PaintAll; +begin + while Assigned(FFirst) do + PaintQueueForWindow(FFirst^.Window); +end; + + +procedure TDirtyList.RemoveEntry(AEntry: PDirtyListEntry); +begin + if Assigned(AEntry^.Prev) then + AEntry^.Prev^.Next := AEntry^.Next + else + FFirst := AEntry^.Next; + if Assigned(AEntry^.Next) then + AEntry^.Next^.Prev := AEntry^.Prev + else + FLast := AEntry^.Prev; + Dispose(AEntry); +end; + + +end. + diff --git a/gfx/emulayer/gelimage.pas b/gfx/emulayer/gelimage.pas new file mode 100644 index 00000000..0701e2fc --- /dev/null +++ b/gfx/emulayer/gelimage.pas @@ -0,0 +1,399 @@ +{ + fpGFX - Free Pascal Graphics Library + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGFX development team. + + Image conversion helpers + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +unit GELImage; + +{$IFDEF Debug} +{$ASSERTIONS On} +{$ENDIF} +{$mode objfpc}{$H+} + +interface + +uses + Classes, + GfxBase; // fpGFX units + + +procedure ConvertImage( + ASourceRect: TRect; ASourceFormat: TGfxPixelFormat; ASourcePal: TGfxPalette; + ASourceData: Pointer; ASourceStride: LongWord; + ADestX, ADestY: Integer; ADestFormat: TGfxPixelFormat; + ADestData: Pointer; ADestStride: LongWord); + +procedure FlipMonoImageBits( + ASourceRect: TRect; ASourceData: Pointer; ASourceStride: LongWord; + ADestX, ADestY: Integer; ADestData: Pointer; ADestStride: LongWord); + + +implementation + +type + TConvertParams = record + RedShiftR, RedShiftL, + GreenShiftR, GreenShiftL, + BlueShiftR, BlueShiftL: Byte; + RedMask, GreenMask, BlueMask: LongWord; + RedMult, GreenMult, BlueMult: Word; + Palette: array[0..255] of LongWord; + end; + + TConvertToInternalProc = procedure(Params: TConvertParams; Data: Pointer; + StartX, EndX: Integer; Dest: Pointer); + + TConvertFromInternalProc = procedure(Params: TConvertParams; Data: Pointer; + Dest: Pointer; Width: Integer); + + +procedure ConvertMonoToInternal(Params: TConvertParams; Data: Pointer; + StartX, EndX: Integer; Dest: Pointer); +var + b: Byte; + Mask: Byte; +begin + Inc(Data, StartX shr 3); + Mask := 1 shl (7 - StartX and 7); + while StartX < EndX do + begin + PLongWord(Dest)^ := Params.Palette[Ord((PByte(Data)^ and Mask) <> 0)]; + if Mask = 1 then + begin + Inc(Data); + Mask := 128; + end else + Mask := Mask shr 1; + Inc(StartX); + Inc(Dest, 4); + end; +end; + +procedure ConvertPal4ToInternal(Params: TConvertParams; Data: Pointer; + StartX, EndX: Integer; Dest: Pointer); +var + b: Byte; +begin + // !!!: Just works for even StartX and EndX values + ASSERT((StartX and 1) = 0); + ASSERT((EndX and 1) = 0); + Inc(Data, StartX shr 1); + while StartX < EndX do + begin + b := PByte(Data)^; + PLongWord(Dest)[0] := Params.Palette[b shr 4]; + PLongWord(Dest)[1] := Params.Palette[b and 15]; + Inc(StartX, 2); + Inc(Data); + Inc(Dest, 8); + end; +end; + +procedure ConvertPal8ToInternal(Params: TConvertParams; Data: Pointer; + StartX, EndX: Integer; Dest: Pointer); +begin + Inc(Data, StartX); + while StartX < EndX do + begin + PLongWord(Dest)^ := Params.Palette[PByte(Data)^]; + Inc(StartX); + Inc(Data); + Inc(Dest, 4); + end; +end; + +procedure ConvertRGB24ToInternal(Params: TConvertParams; Data: Pointer; + StartX, EndX: Integer; Dest: Pointer); +var + PixelIn: LongWord; +begin + Inc(Data, StartX * 3); + while StartX < EndX do + begin + PixelIn := 0; + Move(Data^, PixelIn, 3); + PLongWord(Dest)^ := + (((PixelIn shr Params.RedShiftR) and $ff) shl Params.RedShiftL) or + (((PixelIn shr Params.GreenShiftR) and $ff) shl Params.GreenShiftL) or + (((PixelIn shr Params.BlueShiftR) and $ff) shl Params.BlueShiftL); + Inc(StartX); + Inc(Data, 3); + Inc(Dest, 4); + end; +end; + +procedure ConvertRGB32ToInternal(Params: TConvertParams; Data: Pointer; + StartX, EndX: Integer; Dest: Pointer); +var + PixelIn: LongWord; +begin + Inc(Data, StartX * 4); + while StartX < EndX do + begin + PixelIn := PLongWord(Data)^; + PLongWord(Dest)^ := + (((PixelIn shr Params.RedShiftR) and $ff) shl Params.RedShiftL) or + (((PixelIn shr Params.GreenShiftR) and $ff) shl Params.GreenShiftL) or + (((PixelIn shr Params.BlueShiftR) and $ff) shl Params.BlueShiftL); + Inc(StartX); + Inc(Data, 4); + Inc(Dest, 4); + end; +end; + + +procedure ConvertInternalToRGB16(Params: TConvertParams; Data: Pointer; + Dest: Pointer; Width: Integer); +var + PixelIn: LongWord; +begin + repeat + PixelIn := PLongWord(Data)^; + PWord(Dest)^ := + (((PixelIn and $0000ff) shr Params.RedShiftR) shl Params.RedShiftL) or + (((PixelIn and $00ff00) shr Params.GreenShiftR) shl Params.GreenShiftL) or + (((PixelIn and $ff0000) shr Params.BlueShiftR) shl Params.BlueShiftL); + + Inc(Data, 4); + Inc(Dest, 2); + Dec(Width); + until Width = 0; +end; + +procedure ConvertInternalToRGB24(Params: TConvertParams; Data: Pointer; + Dest: Pointer; Width: Integer); +var + PixelIn, PixelOut: LongWord; +begin + repeat + PixelIn := PLongWord(Data)^; + PixelOut := + (((PixelIn and $0000ff) shr Params.RedShiftR) shl Params.RedShiftL) or + (((PixelIn and $00ff00) shr Params.GreenShiftR) shl Params.GreenShiftL) or + (((PixelIn and $ff0000) shr Params.BlueShiftR) shl Params.BlueShiftL); + PWord(Dest)^ := Word(PixelOut); + PByte(Dest)[2] := PixelOut shr 16; + + Inc(Data, 4); + Inc(Dest, 3); + Dec(Width); + until Width = 0; +end; + +procedure ConvertInternalToRGB32(Params: TConvertParams; Data: Pointer; + Dest: Pointer; Width: Integer); +var + PixelIn: LongWord; +begin + repeat + PixelIn := PLongWord(Data)^; + PLongWord(Dest)^ := + (((PixelIn and $0000ff) shr Params.RedShiftR) shl Params.RedShiftL) or + (((PixelIn and $00ff00) shr Params.GreenShiftR) shl Params.GreenShiftL) or + (((PixelIn and $ff0000) shr Params.BlueShiftR) shl Params.BlueShiftL); + + Inc(Data, 4); + Inc(Dest, 4); + Dec(Width); + until Width = 0; +end; + + +function GetBitShiftAndCount(Mask: LongWord; var Shift: Byte): Integer; +begin + Shift := 0; + while (Mask and 1) = 0 do + begin + Mask := Mask shr 1; + Inc(Shift); + end; + Result := 0; + while Mask > 0 do + begin + Mask := Mask shr 1; + Inc(Result); + end; +end; + +procedure SetupShifts(PixelFormat: TGfxPixelFormat; var Params: TConvertParams); +begin + Params.RedShiftR := 8 - + GetBitShiftAndCount(PixelFormat.RedMask, Params.RedShiftL); + Params.GreenShiftR := 16 - + GetBitShiftAndCount(PixelFormat.GreenMask, Params.GreenShiftL); + Params.BlueShiftR := 24 - + GetBitShiftAndCount(PixelFormat.BlueMask, Params.BlueShiftL); +end; + +procedure ConvertImage( + ASourceRect: TRect; ASourceFormat: TGfxPixelFormat; ASourcePal: TGfxPalette; + ASourceData: Pointer; ASourceStride: LongWord; + ADestX, ADestY: Integer; ADestFormat: TGfxPixelFormat; + ADestData: Pointer; ADestStride: LongWord); + + // returns the highest processed index + function ConvertPalette(MaxIndex: Integer; + var Params: TConvertParams): Integer; + var + i: Integer; + begin + if Assigned(ASourcePal) then + begin + Result := ASourcePal.EntryCount - 1; + if Result > 255 then + Result := 255; + for i := 0 to Result do + with ASourcePal.Entries[i] do + Params.Palette[i] := + (Red div 257) or + ((Green div 257) shl 8) or + ((Blue div 257) shl 16); + end else + Result := -1; + end; + +var + ParamsS2I, ParamsI2D: TConvertParams; // Source to internal, internal to dest + ConvertToInternal: TConvertToInternalProc; + ConvertFromInternal: TConvertFromInternalProc; + Scanline: Pointer; + i, max, w, y: Integer; +begin + case ASourceFormat.FormatType of + ftMono: + begin + ConvertToInternal := @ConvertMonoToInternal; + max := ConvertPalette(1, ParamsS2I); + if max < 1 then + begin + ParamsS2I.Palette[1] := $ffffff; + if max < 0 then + ParamsS2I.Palette[0] := 0; + end; + end; + ftPal4, ftPal4A: + begin + ConvertToInternal := @ConvertPal4ToInternal; + max := ConvertPalette(15, ParamsS2I); + for i := max + 1 to 15 do + ParamsS2I.Palette[i] := 0; + end; + ftPal8, ftPal8A: + begin + ConvertToInternal := @ConvertPal8ToInternal; + max := ConvertPalette(255, ParamsS2I); + for i := max + 1 to 255 do + ParamsS2I.Palette[i] := i or (i shl 8) or (i shl 16); + end; + ftRGB24: + begin + ConvertToInternal := @ConvertRGB24ToInternal; + ParamsS2I.RedShiftR := 8 - + GetBitShiftAndCount(ASourceFormat.RedMask, ParamsS2I.RedShiftL); + ParamsS2I.GreenShiftR := 16 - + GetBitShiftAndCount(ASourceFormat.GreenMask, ParamsS2I.GreenShiftL); + ParamsS2I.BlueShiftR := 24 - + GetBitShiftAndCount(ASourceFormat.BlueMask, ParamsS2I.BlueShiftL); + end; + ftRGB32: + begin + ConvertToInternal := @ConvertRGB32ToInternal; + ParamsS2I.RedShiftR := 8 - + GetBitShiftAndCount(ASourceFormat.RedMask, ParamsS2I.RedShiftL); + ParamsS2I.GreenShiftR := 16 - + GetBitShiftAndCount(ASourceFormat.GreenMask, ParamsS2I.GreenShiftL); + ParamsS2I.BlueShiftR := 24 - + GetBitShiftAndCount(ASourceFormat.BlueMask, ParamsS2I.BlueShiftL); + end; + else + raise EGfxUnsupportedPixelFormat.Create(ASourceFormat); + end; + + case ADestFormat.FormatType of + ftRGB16: + begin + ConvertFromInternal := @ConvertInternalToRGB16; + SetupShifts(ADestFormat, ParamsI2D); + end; + ftRGB24: + begin + ConvertFromInternal := @ConvertInternalToRGB24; + SetupShifts(ADestFormat, ParamsI2D); + end; + ftRGB32: + begin + ConvertFromInternal := @ConvertInternalToRGB32; + SetupShifts(ADestFormat, ParamsI2D); + end; + else + raise EGfxUnsupportedPixelFormat.Create(ASourceFormat); + end; + + w := ASourceRect.Right - ASourceRect.Left; + GetMem(Scanline, w * SizeOf(TGfxPixel)); + for y := ASourceRect.Top to ASourceRect.Bottom - 1 do + begin + ConvertToInternal(ParamsS2I, ASourceData, + ASourceRect.Left, ASourceRect.Right, Scanline); + Inc(ASourceData, ASourceStride); + ConvertFromInternal(ParamsI2D, Scanline, ADestData, w); + Inc(ADestData, ADestStride); + end; + FreeMem(Scanline); +end; + + +procedure FlipMonoImageBits( + ASourceRect: TRect; ASourceData: Pointer; ASourceStride: LongWord; + ADestX, ADestY: Integer; ADestData: Pointer; ADestStride: LongWord); +const + BitFlipTable: array[Byte] of Byte = ( + $00, $80, $40, $C0, $20, $A0, $60, $E0, $10, $90, $50, $D0, $30, $B0, $70, $F0, + $08, $88, $48, $C8, $28, $A8, $68, $E8, $18, $98, $58, $D8, $38, $B8, $78, $F8, + $04, $84, $44, $C4, $24, $A4, $64, $E4, $14, $94, $54, $D4, $34, $B4, $74, $F4, + $0C, $8C, $4C, $CC, $2C, $AC, $6C, $EC, $1C, $9C, $5C, $DC, $3C, $BC, $7C, $FC, + $02, $82, $42, $C2, $22, $A2, $62, $E2, $12, $92, $52, $D2, $32, $B2, $72, $F2, + $0A, $8A, $4A, $CA, $2A, $AA, $6A, $EA, $1A, $9A, $5A, $DA, $3A, $BA, $7A, $FA, + $06, $86, $46, $C6, $26, $A6, $66, $E6, $16, $96, $56, $D6, $36, $B6, $76, $F6, + $0E, $8E, $4E, $CE, $2E, $AE, $6E, $EE, $1E, $9E, $5E, $DE, $3E, $BE, $7E, $FE, + $01, $81, $41, $C1, $21, $A1, $61, $E1, $11, $91, $51, $D1, $31, $B1, $71, $F1, + $09, $89, $49, $C9, $29, $A9, $69, $E9, $19, $99, $59, $D9, $39, $B9, $79, $F9, + $05, $85, $45, $C5, $25, $A5, $65, $E5, $15, $95, $55, $D5, $35, $B5, $75, $F5, + $0D, $8D, $4D, $CD, $2D, $AD, $6D, $ED, $1D, $9D, $5D, $DD, $3D, $BD, $7D, $FD, + $03, $83, $43, $C3, $23, $A3, $63, $E3, $13, $93, $53, $D3, $33, $B3, $73, $F3, + $0B, $8B, $4B, $CB, $2B, $AB, $6B, $EB, $1B, $9B, $5B, $DB, $3B, $BB, $7B, $FB, + $07, $87, $47, $C7, $27, $A7, $67, $E7, $17, $97, $57, $D7, $37, $B7, $77, $F7, + $0F, $8F, $4F, $CF, $2F, $AF, $6F, $EF, $1F, $9F, $5F, $DF, $3F, $BF, $7F, $FF); +var + StartByte, EndByte, x, y: Integer; +begin + StartByte := ASourceRect.Left shr 3; + EndByte := (ASourceRect.Right + 7) shr 3; + Inc(ASourceData, StartByte); + Dec(EndByte, StartByte); + for y := ASourceRect.Top to ASourceRect.Bottom - 1 do + begin + for x := 0 to EndByte do + PByte(ADestData)[x] := BitFlipTable[PByte(ASourceData)[x]]; + Inc(ASourceData, ASourceStride); + Inc(ADestData, ADestStride); + end; +end; + +end. + + diff --git a/gfx/fpgfx.pas b/gfx/fpgfx.pas new file mode 100644 index 00000000..d6d866ae --- /dev/null +++ b/gfx/fpgfx.pas @@ -0,0 +1,168 @@ +{ + fpGUI - Free Pascal GUI Library + + fpGFX - Main unit for the core drawing engine of fpGUI + + Copyright (C) 2000 - 2006 See the file AUTHORS, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + 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. +} +unit fpgfx; + +{$ifdef fpc} + {$mode delphi}{$H+} +{$endif} + +interface + +uses + Classes, SysUtils, + gfxinterface, gfxbase; + +type + + { TFFont } + + TFFont = class(TDefFont) + end; + + { TFCanvas } + + TFCanvas = class(TDefCanvas) + end; + + { TFImage } + + TFImage = class(TDefImage) + end; + + { TFScreen } + + TFScreen = class(TDefScreen) + end; + + { TFWindow } + + TFWindow = class(TDefWindow) + end; + + { TFApplication } + + TFApplication = class(TDefApplication) + private + FDisplayName: String; + protected + FTitle: String; + procedure SetTitle(const ATitle: String); + public + constructor Create; override; + destructor Destroy; override; +// procedure CreateForm(InstanceClass: TComponentClass; var Reference); + property Title: String read FTitle write SetTitle; + end; + +{ Using the singleton pattern to hide instance variables and + only instantiate them when they are referred to for the first time. } +function gScreen: TFScreen; +function gApplication: TFApplication; + + +implementation + + +var + uScreen: TFScreen; + uApplication: TFApplication; + + +function gScreen: TFScreen; +begin + if uScreen = nil then + uScreen := TFScreen.Create; + result := uScreen; +end; + +function gApplication: TFApplication; +begin + if uApplication = nil then + uApplication := TFApplication.Create; + result := uApplication; +end; + + + +{ TFApplication } + +constructor TFApplication.Create; +begin + inherited Create; + +end; + + +destructor TFApplication.Destroy; +begin + + inherited Destroy; +end; + +{procedure TFApplication.CreateForm(AForm: TCustomForm); +var + form: PForm; + Filename: String; + TextStream, BinStream: TStream; +begin + form := @Reference; + form^ := TCustomForm(InstanceClass.Create(Self)); + + Filename := LowerCase(Copy(InstanceClass.ClassName, 2, 255)) + '.frm'; + + TextStream := TFileStream.Create(Filename, fmOpenRead); + BinStream := TMemoryStream.Create; + ObjectTextToBinary(TextStream, BinStream); + TextStream.Free; + + BinStream.Position := 0; + BinStream.ReadComponent(Form^); + BinStream.Free; + + Form^.Show; +end;} + + +procedure TFApplication.SetTitle(const ATitle: String); +begin + if ATitle <> FTitle then FTitle := ATitle; +end; + +{******************************************************************* +* Initialization section +* +* DESCRIPTION: Upon startup FApplication and FScreen objects are created +* and memory for them allocated. +* +*******************************************************************} + +initialization + uScreen := nil; + uApplication := nil; + +{******************************************************************* +* Finalization section +* +* DESCRIPTION: Free memory allocated on the initialization section +* +*******************************************************************} + +finalization + uApplication.Free; + uScreen.Free; + +end. + diff --git a/gfx/gdi/Makefile b/gfx/gdi/Makefile new file mode 100644 index 00000000..753cac82 --- /dev/null +++ b/gfx/gdi/Makefile @@ -0,0 +1,1249 @@ +# +# Makefile generated by fpcmake v1.00 [2000/12/14] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION FPCOPT + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Default FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR=../../../.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override UNITOBJECTS+=gfx_gdi gfximpl +override RSTOBJECTS+=gfx_gdi + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2ht + +# Directories + +override NEEDUNITDIR=.. + +# Packages + +override PACKAGES+=rtl + +# Libraries + +LIBNAME=fpgfx_gdi + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +ifdef inUnix +PPAS=ppas.sh +else +ifdef inOS2 +PPAS=ppas.cmd +else +PPAS=ppas.bat +endif +endif + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Units +##################################################################### + +.PHONY: fpc_units + +override ALLTARGET+=fpc_units + +override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS)) +override INSTALLPPUFILES+=$(UNITPPUFILES) +override CLEANPPUFILES+=$(UNITPPUFILES) + +fpc_units: $(UNITPPUFILES) + +##################################################################### +# Resource strings +##################################################################### + +ifdef RSTOBJECTS +override RSTFILES=$(addsuffix $(RSTEXT),$(RSTOBJECTS)) + +override CLEANRSTFILES+=$(RSTFILES) +endif + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) +ifdef USETAR + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) + cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR) +else + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) + cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/gfx/gdi/Makefile.fpc b/gfx/gdi/Makefile.fpc new file mode 100644 index 00000000..f3807726 --- /dev/null +++ b/gfx/gdi/Makefile.fpc @@ -0,0 +1,36 @@ +# +# Makefile.fpc for fpGFX Win32 GDI support +# + +[package] +name=fpgfx +version=0.3 + +[require] +packages=fcl +unitdir=.. ../emulayer + +[target] +units=gfx_gdi gfxinterface +rst=gfx_gdi + +[compiler] +unitdir=.. ../emulayer +unittargetdir=../units +options=-S2h + +[install] +fpcpackage=y + +[default] +fpcdir=/opt/fpc/src + +#[libs] +#libname=fpgfx + +#[install] +#subdir= + +#[dirs] +#fpcdir=../../../.. +#unitdir=.. diff --git a/gfx/gdi/fpgfxpackage.lpk b/gfx/gdi/fpgfxpackage.lpk new file mode 100644 index 00000000..1753eacc --- /dev/null +++ b/gfx/gdi/fpgfxpackage.lpk @@ -0,0 +1,68 @@ +<?xml version="1.0"?> +<CONFIG> + <Package Version="2"> + <PathDelim Value="\"/> + <Name Value="fpGFXPackage"/> + <Author Value="Graeme Geldenhuys"/> + <CompilerOptions> + <Version Value="5"/> + <PathDelim Value="\"/> + <SearchPaths> + <OtherUnitFiles Value="..\;..\emulayer\"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + <SrcPath Value="$(TargetOS)\"/> + </SearchPaths> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Description Value="Free Pascal GFX Library - [Windows] +"/> + <License Value="LGPL +"/> + <Version Minor="3"/> + <Files Count="6"> + <Item1> + <Filename Value="..\gfxbase.pas"/> + <UnitName Value="GfxBase"/> + </Item1> + <Item2> + <Filename Value="..\emulayer\geldirty.pas"/> + <UnitName Value="GELDirty"/> + </Item2> + <Item3> + <Filename Value="..\emulayer\gelimage.pas"/> + <UnitName Value="GELImage"/> + </Item3> + <Item4> + <Filename Value="gfxinterface.pas"/> + <UnitName Value="GFXInterface"/> + </Item4> + <Item5> + <Filename Value="gfx_gdi.pas"/> + <UnitName Value="GFX_GDI"/> + </Item5> + <Item6> + <Filename Value="..\fpgfx.pas"/> + <UnitName Value="fpgfx"/> + </Item6> + </Files> + <RequiredPkgs Count="1"> + <Item1> + <PackageName Value="FCL"/> + <MinVersion Major="1" Valid="True"/> + </Item1> + </RequiredPkgs> + <UsageOptions> + <UnitPath Value="$(PkgOutDir)\"/> + </UsageOptions> + <PublishOptions> + <Version Value="2"/> + <DestinationDirectory Value="$(TestDir)\publishedpackage\"/> + <IgnoreBinaries Value="False"/> + </PublishOptions> + </Package> +</CONFIG> diff --git a/gfx/gdi/fpgfxpackage.pas b/gfx/gdi/fpgfxpackage.pas new file mode 100644 index 00000000..f4f1dc00 --- /dev/null +++ b/gfx/gdi/fpgfxpackage.pas @@ -0,0 +1,14 @@ +{ This file was automatically created by Lazarus. Do not edit! +This source is only used to compile and install the package. + } + +unit fpGFXPackage; + +interface + +uses + GfxBase, GELDirty, GELImage, GFXInterface, GFX_GDI, fpgfx; + +implementation + +end. diff --git a/gfx/gdi/gdikeys.inc b/gfx/gdi/gdikeys.inc new file mode 100644 index 00000000..e6bd065c --- /dev/null +++ b/gfx/gdi/gdikeys.inc @@ -0,0 +1,330 @@ +{ + fpGFX - Free Pascal Graphics Library + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGFX development team. + + Win32 GDI target implementation: Keycode translation helpers + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +function VirtKeyToKeycode(VirtKey: Byte): Word; +const + TranslTable: array[Byte] of Integer = ( + -1, // $00 + -1, // $01 VK_LBUTTON + -1, // $02 VK_RBUTTON + -1, // $03 VK_CANCEL + -1, // $04 VK_MBUTTON + -1, // $05 VK_XBUTTON1 + -1, // $06 VK_XBUTTON2 + -1, // $07 + keyBackSpace, // $08 VK_BACK + keyTab, // $09 VK_TAB + -1, // $0a + -1, // $0b + keyClear, // $0c VK_CLEAR + keyReturn, // $0d VK_RETURN + -1, // $0e + -1, // $0f + keyShift, // $10 VK_SHIFT + keyCtrl, // $11 VK_CONTROL + keyAlt, // $12 VK_MENU + keyPause, // $13 VK_PAUSE + -1, // $14 VK_CAPITAL + -1, // $15 VK_KANA + -1, // $16 + -1, // $17 VK_JUNJA + -1, // $18 VK_FINAL + -1, // $19 VK_HANJA + -1, // $1a + keyEscape, // $1b VK_ESCAPE + -1, // $1c VK_CONVERT + -1, // $1d VK_NONCONVERT + -1, // $1e VK_ACCEPT + keyModeSwitch, // $1f VK_MODECHANGE + $20, // $20 VK_SPACE + keyPrior, // $21 VK_PRIOR + keyNext, // $22 VK_NEXT + keyEnd, // $23 VK_END + keyHome, // $24 VK_HOME + keyLeft, // $25 VK_LEFT + keyUp, // $26 VK_UP + keyRight, // $27 VK_RIGHT + keyDown, // $28 VK_DOWN + keySelect, // $29 VK_SELECT + keyPrintScreen, // $2a VK_PRINT + keyExecute, // $2b VK_EXECUTE + keyPrintScreen, // $2c VK_SNAPSHOT + keyInsert, // $2d VK_INSERT + keyDelete, // $2e VK_DELETE + keyHelp, // $2f VK_HELP + $30, // $30 '0' + $31, // $31 '1' + $32, // $32 '2' + $33, // $33 '3' + $34, // $34 '4' + $35, // $35 '5' + $36, // $36 '6' + $37, // $37 '7' + $38, // $38 '8' + $39, // $39 '9' + -1, // $3a + -1, // $3b + -1, // $3c + -1, // $3d + -1, // $3e + -1, // $3f + -1, // $40 + $41, // $41 'A' + $42, // $42 'B' + $43, // $43 'C' + $44, // $44 'D' + $45, // $45 'E' + $46, // $46 'F' + $47, // $47 'G' + $48, // $48 'H' + $49, // $49 'I' + $4a, // $4a 'J' + $4b, // $4b 'K' + $4c, // $4c 'L' + $4d, // $4d 'M' + $4e, // $4e 'N' + $4f, // $4f 'O' + $50, // $50 'P' + $51, // $51 'Q' + $52, // $52 'R' + $53, // $53 'S' + $54, // $54 'T' + $55, // $55 'U' + $56, // $56 'V' + $57, // $57 'W' + $58, // $58 'X' + $59, // $59 'Y' + $5a, // $5a 'Z' + -1, // $5b VK_LWIN + -1, // $5c VK_RWIN + -1, // $5d VK_APPS + -1, // $5e + -1, // $5f VK_SLEEP + keyP0, // $60 VK_NUMPAD0 + keyP1, // $61 VK_NUMPAD1 + keyP2, // $62 VK_NUMPAD2 + keyP3, // $63 VK_NUMPAD3 + keyP4, // $64 VK_NUMPAD4 + keyP5, // $65 VK_NUMPAD5 + keyP6, // $66 VK_NUMPAD6 + keyP7, // $67 VK_NUMPAD7 + keyP8, // $68 VK_NUMPAD8 + keyP9, // $69 VK_NUMPAD9 + keyPAsterisk, // $6a VK_MULTIPLY + keyPPlus, // $6b VK_ADD + keyPSeparator, // $6c VK_SEPARATOR + keyPMinus, // $6d VK_SUBTRACT + keyPDecimal, // $6e VK_DECIMAL + keyPSlash, // $6f VK_DIVIDE + keyF1, // $70 VK_F1 + keyF2, // $71 VK_F2 + keyF3, // $72 VK_F3 + keyF4, // $73 VK_F4 + keyF5, // $74 VK_F5 + keyF6, // $75 VK_F6 + keyF7, // $76 VK_F7 + keyF8, // $77 VK_F8 + keyF9, // $78 VK_F9 + keyF10, // $79 VK_F10 + keyF11, // $7a VK_F11 + keyF12, // $7b VK_F12 + keyF13, // $7c VK_F13 + keyF14, // $7d VK_F14 + keyF15, // $7e VK_F15 + keyF16, // $7f VK_F16 + keyF17, // $80 VK_F17 + keyF18, // $81 VK_F18 + keyF19, // $82 VK_F19 + keyF20, // $83 VK_F20 + keyF21, // $84 VK_F21 + keyF22, // $85 VK_F22 + keyF23, // $86 VK_F23 + keyF24, // $87 VK_F24 + -1, // $88 + -1, // $89 + -1, // $8a + -1, // $8b + -1, // $8c + -1, // $8d + -1, // $8e + -1, // $8f + keyNumLock, // $90 VK_NUMLOCK + keyScroll, // $91 VK_SCROLL + -1, // $92 VK_OEM_NEC_EQUAL + -1, // $93 VK_OEM_FJ_MASSHOU + -1, // $94 VK_OEM_FJ_TOUROKU + -1, // $95 VK_OEM_FJ_LOYA + -1, // $96 VK_OEM_FJ_ROYA + -1, // $97 + -1, // $98 + -1, // $99 + -1, // $9a + -1, // $9b + -1, // $9c + -1, // $9d + -1, // $9e + -1, // $9f + keyShiftL, // $a0 VK_LSHIFT + keyShiftR, // $a1 VK_RSHIFT + keyCtrlL, // $a2 VK_LCONTROL + keyCtrlR, // $a3 VK_RCONTROL + -1, // $a4 VK_LMENU + -1, // $a5 VK_RMENU + -1, // $a6 VK_BROWSER_BACK + -1, // $a7 VK_BROWSER_FORWARD + -1, // $a8 VK_BROWSER_REFRESH + -1, // $a9 VK_BROWSER_STOP + -1, // $aa VK_BROWSER_SEARCH + -1, // $ab VK_BROWSER_FAVORITES + -1, // $ac VK_BROWSER_HOME + -1, // $ad VK_VOLUME_MUTE + -1, // $ae VK_VOLUME_DOWN + -1, // $af VK_VOLUME_UP + -1, // $b0 VK_MEDIA_NEXT_TRACK + -1, // $b1 VK_MEDIA_PREV_TRACK + -1, // $b2 VK_MEDIA_STOP + -1, // $b3 VK_MEDIA_PLAY_PAUSE + -1, // $b4 VK_LAUNCH_MAIL + -1, // $b5 VK_LAUNCH_MEDIA_SELECT + -1, // $b6 VK_LAUNCH_APP1 + -1, // $b7 VK_LAUNCH_APP2 + -1, // $b8 + -1, // $b9 + $dc, {U Umlaut} // $ba VK_OEM_1 + $2b, {+ char} // $bb VK_OEM_PLUS + $2c, {, char} // $bc VK_OEM_COMMA + $2d, {- char} // $bd VK_OEM_MINUS + $2e, {. char} // $be VK_OEM_PERIOD + $23, {# char} // $bf VK_OEM_2 + $d6, {O Umlaut} // $c0 VK_OEM_3 + -1, // $c1 + -1, // $c2 + -1, // $c3 + -1, // $c4 + -1, // $c5 + -1, // $c6 + -1, // $c7 + -1, // $c8 + -1, // $c9 + -1, // $ca + -1, // $cb + -1, // $cc + -1, // $cd + -1, // $ce + -1, // $cf + -1, // $d0 + -1, // $d1 + -1, // $d2 + -1, // $d3 + -1, // $d4 + -1, // $d5 + -1, // $d6 + -1, // $d7 + -1, // $d8 + -1, // $d9 + -1, // $da + -1, // $db VK_OEM_4 + keyDeadCircumflex, // $dc VK_OEM_5 + keyDeadAcute, // $dd VK_OEM_6 + $c4, {A Umlaut} // $de VK_OEM_7 + -1, // $df VK_OEM_8 + -1, // $e0 + -1, // $e1 VK_OEM_AX + $3c, {< char} // $e2 VK_OEM_102 + -1, // $e3 VK_ICO_HELP + keyP5, // $e4 VK_ICO_00 + -1, // $e5 VK_PROCESSKEY + -1, // $e6 VK_ICO_CLEAR + -1, // $e7 VK_PACKET + -1, // $e8 + -1, // $e9 VK_OEM_RESET + -1, // $ea VK_OEM_JUMP + -1, // $eb VK_OEM_PA1 + -1, // $ec VK_OEM_PA2 + -1, // $ed VK_OEM_PA3 + -1, // $ee VK_OEM_WSCTRL + -1, // $ef VK_OEM_CUSEL + -1, // $f0 VK_OEM_ATTN + -1, // $f1 VK_OEM_FINISH + -1, // $f2 VK_OEM_COPY + -1, // $f3 VK_OEM_AUTO + -1, // $f4 VK_OEM_ENLW + -1, // $f5 VK_OEM_BACKTAB + -1, // $f6 VK_ATTN + -1, // $f7 VK_CRSEL + -1, // $f8 VK_EXSEL + -1, // $f9 VK_EREOF + -1, // $fa VK_PLAY + -1, // $fb VK_ZOOM + -1, // $fc VK_NONAME + -1, // $fd VK_PA1 + -1, // $fe VK_OEM_CLEAR + -1 // $ff + ); +begin + if TranslTable[VirtKey] = -1 then + begin +{$IFDEF Debug} + WriteLn('No mapping for virtual keycode $', IntToHex(VirtKey, 2)); +{$ENDIF} + Result := keyNIL + end else + begin + Result := TranslTable[VirtKey]; + // WriteLn('Key $', IntToHex(VirtKey, 2), ' mapped to $', IntToHex(Result, 4)); + end; +end; + + +function GetKeyboardShiftState: TShiftState; +var + State: array[Byte] of Byte; +begin + Windows.GetKeyboardState(State); + Result := []; + if (State[VK_SHIFT] and 128) <> 0 then + Include(Result, ssShift); + if (State[VK_MENU] and 128) <> 0 then + Include(Result, ssAlt); + if (State[VK_CONTROL] and 128) <> 0 then + Include(Result, ssCtrl); + if (State[VK_LBUTTON] and 128) <> 0 then + Include(Result, ssLeft); + if (State[VK_RBUTTON] and 128) <> 0 then + Include(Result, ssRight); + if (State[VK_MBUTTON] and 128) <> 0 then + Include(Result, ssMiddle); + if (State[VK_CAPITAL] and 1) <> 0 then + Include(Result, ssCaps); + if (State[VK_NUMLOCK] and 1) <> 0 then + Include(Result, ssNum); + if (State[VK_SCROLL] and 1) <> 0 then + Include(Result, ssScroll); +end; + + +{ + $Log: gdikeys.inc,v $ + Revision 1.2 2001/02/09 20:44:59 sg + * Fixed lots of keyboard mapping bugs + + Revision 1.1 2001/01/11 23:07:24 sg + *** empty log message *** + +} diff --git a/gfx/gdi/gfx_gdi.pas b/gfx/gdi/gfx_gdi.pas new file mode 100644 index 00000000..10945b54 --- /dev/null +++ b/gfx/gdi/gfx_gdi.pas @@ -0,0 +1,1730 @@ +{ + fpGUI - Free Pascal GUI Library + + GFX_GDI - Windows GDI specific code + + Copyright (C) 2000 - 2006 See the file AUTHORS, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + 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. +} +unit GFX_GDI; + +{$ifdef fpc} + {$mode delphi}{$H+} +{$endif} + +interface + +uses + Windows, + SysUtils, Classes, + GfxBase; + + +resourcestring + SGDICanvasInvalidFontClass = + 'Tried to set font of class "%s" into GDI context. ' + + 'Only TGDIFont is allowed.'; + +{ Constants missing on windows unit } +const + WM_MOUSEWHEEL = $020a; + + VER_PLATFORM_WIN32_CE = 3; + +{ Unicode selection variables } +var + UnicodeEnabledOS: Boolean; + + WinVersion: TOSVersionInfo; + +type + + EGDIError = class(EGfxError); + + { TGDIFont } + + TGDIFont = class(TFCustomFont) + public + class function GetDefaultFontName(const AFontClass: TGfxFontClass): String; override; + constructor Create(const Descriptor: String); + destructor Destroy; override; + end; + + + { TGDICanvas } + + PGDICanvasState = ^TGDICanvasState; + TGDICanvasState = record + Prev: PGDICanvasState; + Matrix: TGfxMatrix; + Color, PenColor, FontColor: TGfxPixel; + PenLineStyle: TGfxLineStyle; + Font: TFCustomFont; + CurFontHandle: HFONT; + end; + + TGDICanvas = class(TFCustomCanvas) + private + FHandle: HDC; + FColor, FBrushColor, FPenColor, FFontColor: TGfxPixel; + FLineStyle, FPenLineStyle: TGfxLineStyle; + FBrush, FOldBrush: HBRUSH; + FPen, FOldPen: HPEN; + FFont: TFCustomFont; + FFontHandle, FDefaultFontHandle, FCurFontHandle: HFONT; + FFontMetrics: TTextMetric; + FStateStackpointer: PGDICanvasState; + procedure Resized(NewWidth, NewHeight: Integer); + protected + function DoExcludeClipRect(const ARect: TRect): Boolean; override; + function DoIntersectClipRect(const ARect: TRect): Boolean; override; + function DoUnionClipRect(const ARect: TRect): Boolean; override; + function DoGetClipRect: TRect; override; + procedure NeedBrush; + procedure NeedPen; + procedure NeedFont(ANeedFontColor: Boolean); + procedure NeedFontColor; + procedure DoDrawArc(const ARect: TRect; StartAngle, EndAngle: Single); override; + procedure DoDrawCircle(const ARect: TRect); override; + procedure DoDrawLine(const AFrom, ATo: TPoint); override; + procedure DoDrawPoint(const APoint: TPoint); override; + procedure DoFillRect(const ARect: TRect); override; + procedure DoTextOut(const APosition: TPoint; const AText: String); override; + procedure DoCopyRect(ASource: TFCustomCanvas; const ASourceRect: TRect; const ADestPos: TPoint); override; + procedure DoMaskedCopyRect(ASource, AMask: TFCustomCanvas; const ASourceRect: TRect; const AMaskPos, ADestPos: TPoint); override; + procedure DoDrawImageRect(AImage: TFCustomImage; ASourceRect: TRect; const ADestPos: TPoint); override; + public + constructor Create(AHandle: HDC); + destructor Destroy; override; + function MapColor(const AColor: TGfxColor): TGfxPixel; override; + function FontCellHeight: Integer; override; + function TextExtent(const AText: String): TSize; override; + procedure SaveState; override; + procedure RestoreState; override; + procedure EmptyClipRect; override; + procedure SetColor_(AColor: TGfxPixel); override; + procedure SetFont(AFont: TFCustomFont); override; + procedure SetLineStyle(ALineStyle: TGfxLineStyle); override; + property Handle: HDC read FHandle; + end; + + + TGDIWindowCanvas = class(TGDICanvas) + private + FWnd: HWND; + public + constructor Create(AWnd: HWND); + destructor Destroy; override; + end; + + + TGDIBitmapCanvas = class(TGDICanvas) + private + FBitmap, FOldBitmap: HBITMAP; + public + constructor Create(ABitmap: HBITMAP; AWidth, AHeight: Integer); + destructor Destroy; override; + property Bitmap: HBITMAP read FBitmap; + end; + + { TGDIImage } + + TGDIImage = class(TFCustomImage) + private + FHandle: HBITMAP; + IsLocked: Boolean; + protected + FStride: LongWord; + FData: Pointer; + public + constructor Create(AWidth, AHeight: Integer; APixelFormat: TGfxPixelFormat); override; + destructor Destroy; override; + procedure Lock(var AData: Pointer; var AStride: LongWord); override; + procedure Unlock; override; + property Handle: HBITMAP read FHandle; + property Stride: LongWord read FStride; + property Data: Pointer read FData; + end; + + { TGDIScreen } + + TGDIScreen = class(TFCustomScreen) + public + constructor Create; override; + end; + + + { TGDIApplication } + + TGDIApplication = class(TFCustomApplication) + private + DoBreakRun: Boolean; + public + { default methods } + constructor Create; override; + destructor Destroy; override; + procedure AddWindow(AWindow: TFCustomWindow); override; + procedure Initialize(ADisplayName: String = ''); override; + procedure Run; override; + procedure Quit; override; + end; + + { TGDIWindow } + + TGDIWindow = class(TFCustomWindow) + private + FMinSize, FMaxSize: TSize; + FParent: TFCustomWindow; + { Messages } + procedure WMCreate(var Msg: TMessage); message WM_CREATE; + procedure WMDestroy(var Msg: TMessage); message WM_DESTROY; + procedure WMGetMinMaxInfo(var Msg: TMessage); message WM_GETMINMAXINFO; + procedure WMActivate(var Msg: TMessage); message WM_ACTIVATE; + procedure WMPaint(var Msg: TMessage); message WM_PAINT; + procedure WMShowWindow(var Msg: TMessage); message WM_SHOWWINDOW; + procedure WMMove(var Msg: TMessage); message WM_MOVE; + procedure WMSize(var Msg: TMessage); message WM_SIZE; + { Input messages } + procedure WMLButtonDown(var Msg: TMessage); message WM_LBUTTONDOWN; + procedure WMLButtonUp(var Msg: TMessage); message WM_LBUTTONUP; + procedure WMRButtonDown(var Msg: TMessage); message WM_RBUTTONDOWN; + procedure WMRButtonUp(var Msg: TMessage); message WM_RBUTTONUP; + procedure WMMButtonDown(var Msg: TMessage); message WM_MBUTTONDOWN; + procedure WMMButtonUp(var Msg: TMessage); message WM_MBUTTONUP; + procedure WMMouseMove(var Msg: TMessage); message WM_MOUSEMOVE; + procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL; + procedure WMKeyDown(var Msg: TMessage); message WM_KEYDOWN; + procedure WMKeyUp(var Msg: TMessage); message WM_KEYUP; + procedure WMChar(var Msg: TMessage); message WM_CHAR; + procedure WMSysKeyDown(var Msg: TMessage); message WM_SYSKEYDOWN; + procedure WMSysKeyUp(var Msg: TMessage); message WM_SYSKEYUP; + procedure WMSysChar(var Msg: TMessage); message WM_SYSCHAR; + protected + WindowClass: TWndClass; + WindowClassW: TWndClassW; + FWindowStyle, FWindowStyleEx: LongWord; + FMouseInWindow, FHasMouseCapture, FHasFocus: Boolean; + function GetTitle: String; override; + procedure SetTitle(const ATitle: String); override; + procedure DoSetCursor; override; + procedure UpdateWindowButtons; + function DoMouseEnterLeaveCheck(const Msg: TMessage): Boolean; + public + constructor Create(AParent: TFCustomWindow; AWindowOptions: TGfxWindowOptions); + destructor Destroy; override; + procedure DefaultHandler(var Message); override; + procedure SetPosition(const APosition: TPoint); override; + procedure SetSize(const ASize: TSize); override; + procedure SetMinMaxSize(const AMinSize, AMaxSize: TSize); override; + procedure SetClientSize(const ASize: TSize); override; + procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); override; + procedure Show; override; + procedure Invalidate(const ARect: TRect); override; + procedure PaintInvalidRegion; override; + procedure CaptureMouse; override; + procedure ReleaseMouse; override; + end; + + +function RectToWinRect(const ARect: TRect): Windows.Rect; +function WinRectToRect(const ARect: Windows.Rect): TRect; + +function VirtKeyToKeycode(VirtKey: Byte): Word; +function GetKeyboardShiftState: TShiftState; + + +implementation + +uses + math, fpgfx; + +{ + Use CenterPoint to get the Center-Point of any rectangle. It is primarily + for use with, and in, other routines such as Quadrant, and RadialPoint. +} +function CenterPoint(Rect : TRect) : TPoint; +var + Tmp : Longint; +begin + With Rect do begin + + If Right < Left then begin + Tmp := Right; + Right := Left; + Left := Tmp; + end; + + If Bottom < Top then begin + Tmp := Bottom; + Bottom := Top; + Top := Tmp; + end; + + Result.X := Left + (Right - Left) div 2; + Result.Y := Top + (Bottom - Top) div 2; + end; +end; + + +{ + Use LineEndPoint to get the End-Point of a line of any given Length at + any given angle with any given Start-Point. It is primarily for use in + other routines such as RadialPoint. The angle is in 1/16th of a degree. + For example, a full circle equals 5760 (16*360). Zero degrees is at the + 3'o clock position. +} +Function LineEndPoint(StartPoint : TPoint; Angle, Length : Extended) : +TPoint; +begin + if Angle > 360*16 then + Angle := Frac(Angle / 360*16) * 360*16; + + if Angle < 0 then + Angle := 360*16 - abs(Angle); + + Result.Y := StartPoint.Y - Round(Length*Sin(DegToRad(Angle/16))); + Result.X := StartPoint.X + Round(Length*Cos(DegToRad(Angle/16))); +end; + + +{ + Use EllipseRadialLength to get the Radial-Length of non-rotated ellipse at + any given Eccentric( aka Radial ) Angle. It is primarily for use in other + routines such as RadialPoint. The Eccentric angle is in 1/16th of a degree. + For example, a full circle equals 5760 (16*360). Zero degrees is at the + 3'o clock position. +} +function EllipseRadialLength(Rect: TRect; EccentricAngle: Extended): Longint; +var + a, b, R : Extended; +begin + a := (Rect.Right - Rect.Left) div 2; + b := (Rect.Bottom - Rect.Top) div 2; + R := Sqr(a)*Sqr(b); + R := Sqrt(R / ((Sqr(b)*Sqr(Cos(DegToRad(EccentricAngle/16)))) + + (Sqr(a)*Sqr(Sin(DegToRad(EccentricAngle/16)))))); + Result := integer(Trunc(R)); +end; + + +{ + Use RadialPoint to get the Radial-Point at any given Eccentric( aka Radial ) + angle on any non-rotated ellipse. It is primarily for use in Angles2Coords. + The EccentricAngle is in 1/16th of a degree. For example, a full circle + equals 5760 (16*360). Zero degrees is at the 3'o clock position. +} +function RadialPoint(EccentricAngle: Extended; Rect: TRect): TPoint; +var + R: Longint; +Begin + R := EllipseRadialLength(Rect, EccentricAngle); + Result := LineEndPoint(CenterPoint(Rect), EccentricAngle, R); +end; + + +{ + Use Angles2Coords to convert an Eccentric(aka Radial) Angle and an + Angle-Length, such as are used in X-Windows and GTK, into the coords, + for Start and End Radial-Points, such as are used in the Windows API Arc + Pie and Chord routines. The angles are 1/16th of a degree. For example, a + full circle equals 5760 (16*360). Positive values of Angle and AngleLength + mean counter-clockwise while negative values mean clockwise direction. + Zero degrees is at the 3'o clock position. +} +procedure Angles2Coords(X, Y, Width, Height: Integer; Angle1, Angle2: Extended; + var SX, SY, EX, EY: Integer); +var + aRect: TRect; + SP, EP: TPoint; +begin + aRect := Rect(X, Y, X + Width, Y + Height); + SP := RadialPoint(Angle1, aRect); + If Angle2 + Angle1 > 360*16 then + Angle2 := (Angle2 + Angle1) - 360*16 + else + Angle2 := Angle2 + Angle1; + EP := RadialPoint(Angle2, aRect); + SX := SP.X; + SY := SP.Y; + EX := EP.X; + EY := EP.Y; +end; + + +{ TGDIFont } + +class function TGDIFont.GetDefaultFontName(const AFontClass: TGfxFontClass): String; +const + FontNames: array[TGfxFontClass] of String = ( + 'Times New Roman', 'Arial', 'Courier New', 'Wingdings'); +begin + Result := FontNames[AFontClass]; +end; + +constructor TGDIFont.Create(const Descriptor: String); +type + TXLFDFields = (lfdFoundry, lfdFamily, lfdWeight, lfdSlant, lfdSetWidth, + lfdAddStyle, lfdPixelSize, lfdPointSize, lfdResolutionX, lfdResolutionY, + lfdSpacing, lfdAverageWidth, lfdCharsetRegistry, lfdCharsetEncoding); +var + Fields: array[TXLFDFields] of String; + FontInfo: LOGFONT; + FieldIndex: TXLFDFields; + s: String; + i: Integer; + dc: HDC; +begin + inherited Create; + + // Split the font descriptor string + s := Descriptor; + for FieldIndex := Low(TXLFDFields) to High(TXLFDFields) do + begin + Fields[FieldIndex] := Copy(s, 2, Length(s)); + i := Pos('-', Fields[FieldIndex]); + if i = 0 then + i := Length(s); + Fields[FieldIndex] := Copy(Fields[FieldIndex], 1, i - 1); + s := Copy(s, i + 1, Length(s)); + end; + + FillChar(FontInfo, SizeOf(FontInfo), 0); + + if (Length(Fields[lfdPixelSize]) > 0) and (Fields[lfdPixelSize] <> '*') then + FontInfo.lfHeight := -StrToInt(Fields[lfdPixelSize]) + else if (Length(Fields[lfdPointSize]) > 0) and + (Fields[lfdPointSize] <> '*') then + begin + dc := Windows.GetDC(0); + FontInfo.lfHeight := ((StrToInt(Fields[lfdPointSize]) * + Windows.GetDeviceCaps(dc, LOGPIXELSY)) + (5 * 72)) div 720; + Windows.ReleaseDC(0, dc); + end; + + if (Length(Fields[lfdAverageWidth]) > 0) and + (Fields[lfdAverageWidth] <> '*') then + FontInfo.lfWidth := StrToInt(Fields[lfdAverageWidth]); + + if CompareText(Fields[lfdWeight], 'medium') = 0 then + FontInfo.lfWeight := FW_MEDIUM + else if CompareText(Fields[lfdWeight], 'bold') = 0 then + FontInfo.lfWeight := FW_BOLD; + + if (CompareText(Fields[lfdSlant], 'i') = 0) or + (CompareText(Fields[lfdSlant], 'o') = 0) then + FontInfo.lfItalic := 1; + + if (CompareText(Fields[lfdSpacing], 'm') = 0) or + (CompareText(Fields[lfdSpacing], 'c') = 0) then + FontInfo.lfPitchAndFamily := FIXED_PITCH + else if CompareText(Fields[lfdSpacing], 'p') = 0 then + FontInfo.lfPitchAndFamily := VARIABLE_PITCH; + + if Fields[lfdFamily] <> '*' then + FontInfo.lfFaceName := Fields[lfdFamily]; + + FHandle := Windows.CreateFontIndirect(@FontInfo); +end; + + +destructor TGDIFont.Destroy; +begin + Windows.DeleteObject(Handle); + inherited Destroy; +end; + + +{ TGDICanvas } + +constructor TGDICanvas.Create(AHandle: HDC); +begin + inherited Create; + FHandle := AHandle; + ASSERT(Handle <> 0); + FDefaultFontHandle := Windows.GetStockObject(DEFAULT_GUI_FONT); + FCurFontHandle := FDefaultFontHandle; + Windows.SelectObject(Handle, FDefaultFontHandle); + Windows.GetTextMetrics(Handle, @FFontMetrics); + Windows.SetBkMode(Handle, TRANSPARENT); +end; + + +destructor TGDICanvas.Destroy; +begin + if FBrush <> 0 then + begin + Windows.SelectObject(Handle, FOldBrush); + Windows.DeleteObject(FBrush); + end; + if FPen <> 0 then + begin + Windows.SelectObject(Handle, FOldPen); + Windows.DeleteObject(FPen); + end; + inherited Destroy; +end; + + +procedure TGDICanvas.SaveState; +var + SavedState: PGDICanvasState; + NewRegion: HRGN; +begin + New(SavedState); + SavedState^.Prev := FStateStackpointer; + SavedState^.Matrix := Matrix; + SavedState^.Color := FColor; + SavedState^.PenColor := FPenColor; + SavedState^.PenLineStyle := FPenLineStyle; + SavedState^.FontColor := FFontColor; + SavedState^.Font := FFont; + SavedState^.CurFontHandle := FCurFontHandle; + FStateStackpointer := SavedState; + { !!!: This is very dangerous! Some of the FCurXXX variables are not saved in + SavedState, which might result in graphics errors under certain + circumstances. Better try to remove SaveDC/RestoreDC completely. } + Windows.SaveDC(Handle); +end; + + +procedure TGDICanvas.RestoreState; +var + SavedState: PGDICanvasState; +begin + Windows.RestoreDC(Handle, -1); + + SavedState := FStateStackpointer; + FStateStackpointer := SavedState^.Prev; + Matrix := SavedState^.Matrix; + FColor := SavedState^.Color; + FPenColor := SavedState^.PenColor; + FPenLineStyle := SavedState^.PenLineStyle; + FFontColor := SavedState^.FontColor; + FCurFontHandle := SavedState^.CurFontHandle; + SetFont(SavedState^.Font); + Dispose(SavedState); +end; + + +procedure TGDICanvas.EmptyClipRect; +begin + Windows.IntersectClipRect(Handle, 0, 0, 0, 0); +end; + + +function TGDICanvas.DoExcludeClipRect(const ARect: TRect): Boolean; +begin + with ARect do + Result := + Windows.ExcludeClipRect(Handle, Left, Top, Right, Bottom) <> NULLREGION; +end; + + +function TGDICanvas.DoIntersectClipRect(const ARect: TRect): Boolean; +begin + with ARect do + Result := + Windows.IntersectClipRect(Handle, Left, Top, Right, Bottom) <> NULLREGION +end; + + +function TGDICanvas.DoUnionClipRect(const ARect: TRect): Boolean; +var + Region: HRGN; +begin + with ARect do + Region := Windows.CreateRectRgn(Left, Top, Right, Bottom); + Result := Windows.ExtSelectClipRgn(Handle, Region, RGN_OR) <> NULLREGION; + Windows.DeleteObject(Region); +end; + + +function TGDICanvas.DoGetClipRect: TRect; +var + Rect: Windows.Rect; +begin + Windows.GetClipBox(Handle, Rect); + Result := TRect(Rect); +end; + + +function TGDICanvas.MapColor(const AColor: TGfxColor): TGfxPixel; +begin +{ Result := Windows.GetNearestColor(Handle, RGB(AColor.Red div 257, + AColor.Green div 257, AColor.Blue div 257));} + Result := RGB(AColor.Red div 257, AColor.Green div 257, AColor.Blue div 257); +end; + + +procedure TGDICanvas.SetColor_(AColor: TGfxPixel); +begin + FColor := AColor; +end; + + +procedure TGDICanvas.SetFont(AFont: TFCustomFont); +begin + if AFont = FFont then + exit; + + FFont := AFont; + + if not Assigned(AFont) then + FFontHandle := FDefaultFontHandle + else + begin + if not AFont.InheritsFrom(TGDIFont) then + raise EGfxError.CreateFmt(SGDICanvasInvalidFontClass, [AFont.ClassName]); + FFontHandle := TGDIFont(AFont).Handle; + end; +end; + + +procedure TGDICanvas.SetLineStyle(ALineStyle: TGfxLineStyle); +begin + FLineStyle := ALineStyle; +end; + + +procedure TGDICanvas.DoDrawArc(const ARect: TRect; StartAngle, EndAngle: Single); +var + SX, SY, EX, EY : Longint; +begin + {$Warning DoDrawArc needs testing. } + Angles2Coords(ARect.Left, ARect.Top, ARect.Right - ARect.Left, + ARect.Bottom - ARect.Top, StartAngle, EndAngle, SX, SY, EX, EY); + Windows.Arc(Handle, ARect.Left, ARect.Top, ARect.Right, + ARect.Bottom, SX, SY, EX, EY) +end; + + +procedure TGDICanvas.DoDrawCircle(const ARect: TRect); +begin + {$Warning DoDrawCircle needs testing. } + Windows.Ellipse(Handle, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom); +end; + + +procedure TGDICanvas.DoDrawLine(const AFrom, ATo: TPoint); +begin + NeedPen; + Windows.MoveToEx(Handle, AFrom.x, AFrom.y, nil); + Windows.LineTo(Handle, ATo.x, ATo.y); +end; + + +procedure TGDICanvas.DoDrawPoint(const APoint: TPoint); +begin + {$Warning This is not implemented yet. } + // Use DrawLine() as windows doesn't have a DrawPoint. It does have a + // SetPixel() method, but not sure how to use it yet. + DoDrawLine(APoint, APoint); +// DoFillRect(Rect(APoint.X, APoint.Y, APoint.X, APoint.Y)); +end; + + +procedure TGDICanvas.DoFillRect(const ARect: TRect); +var + r: Windows.Rect; +begin + NeedBrush; + r := RectToWinRect(ARect); + Windows.FillRect(Handle, r, FBrush); +end; + + +function TGDICanvas.FontCellHeight: Integer; +begin + NeedFont(False); + Result := FFontMetrics.tmHeight; +end; + + +function TGDICanvas.TextExtent(const AText: String): TSize; +var + WideText: WideString; +begin + NeedFont(False); + + WideText := Utf8Decode(AText); + Windows.GetTextExtentPoint32W(Handle, PWideChar(WideText), Length(WideText), @Result) +end; + + +procedure TGDICanvas.DoTextOut(const APosition: TPoint; const AText: String); +var + WideText: WideString; +begin + NeedFont(True); + + WideText := Utf8Decode(AText); + Windows.TextOutW(Handle, APosition.x, APosition.y, PWideChar(WideText), Length(WideText)) +end; + + +procedure TGDICanvas.DoCopyRect(ASource: TFCustomCanvas; const ASourceRect: TRect; + const ADestPos: TPoint); +begin + if not ASource.InheritsFrom(TGDICanvas) then + raise EGDIError.CreateFmt(SIncompatibleCanvasForBlitting, + [ASource.ClassName, Self.ClassName]); + + Windows.BitBlt( + Handle, ADestPos.x, ADestPos.y, ASourceRect.Right - ASourceRect.Left, + ASourceRect.Bottom - ASourceRect.Top, + TGDICanvas(ASource).Handle, ASourceRect.Left, ASourceRect.Top, + SRCCOPY); +end; + + +procedure TGDICanvas.DoMaskedCopyRect(ASource, AMask: TFCustomCanvas; + const ASourceRect: TRect; const AMaskPos, ADestPos: TPoint); +var + w, h: Integer; + SourceBitmap, AndObjectBitmap, AndMemBitmap, SaveBitmap, + OldSourceBitmap, OldAndObjectBitmap, OldAndMemBitmap, + OldSaveBitmap: HBITMAP; + SourceDC, MemDC, ObjectDC, SaveDC: HDC; +begin + if not ASource.InheritsFrom(TGDICanvas) then + raise EGDIError.CreateFmt(SIncompatibleCanvasForBlitting, + [ASource.ClassName, Self.ClassName]); + + if not AMask.InheritsFrom(TGDICanvas) then + raise EGDIError.CreateFmt(SIncompatibleCanvasForBlitting, + [AMask.ClassName, Self.ClassName]); + + w := ASourceRect.Right - ASourceRect.Left; + h := ASourceRect.Bottom - ASourceRect.Top; + + // See http://support.microsoft.com/support/kb/articles/Q79/2/12.ASP + + SourceDC := Windows.CreateCompatibleDC(Handle); + ObjectDC := Windows.CreateCompatibleDC(Handle); + MemDC := Windows.CreateCompatibleDC(Handle); + SourceBitmap := Windows.CreateCompatibleBitmap(Handle, w, h); + AndObjectBitmap := Windows.CreateCompatibleBitmap(ObjectDC, w, h); + AndMemBitmap := Windows.CreateCompatibleBitmap(Handle, w, h); + OldSourceBitmap := Windows.SelectObject(SourceDC, SourceBitmap); + OldAndObjectBitmap := Windows.SelectObject(ObjectDC, AndObjectBitmap); + OldAndMemBitmap := Windows.SelectObject(MemDC, AndMemBitmap); + + Windows.BitBlt(SourceDC, 0, 0, w, h, + TGDICanvas(ASource).Handle, ASourceRect.Left, ASourceRect.Top, SRCCOPY); + Windows.BitBlt(MemDC, 0, 0, w, h, Handle, ADestPos.x, ADestPos.y, SRCCOPY); + + // !!!: Find a ROP for replacing the following 2 Blits with a single one: + Windows.BitBlt(ObjectDC, 0, 0, w, h, + TGDICanvas(AMask).Handle, AMaskPos.x, AMaskPos.y, NOTSRCCOPY); + Windows.BitBlt(MemDC, 0, 0, w, h, ObjectDC, 0, 0, SRCAND); + + Windows.BitBlt(SourceDC, 0, 0, w, h, + TGDICanvas(AMask).Handle, AMaskPos.x, AMaskPos.y, SRCAND); + Windows.BitBlt(MemDC, 0, 0, w, h, SourceDC, 0, 0, SRCPAINT); + // Copy the result to the screen + Windows.BitBlt(Handle, ADestPos.x, ADestPos.y, w, h, MemDC, 0, 0, SRCCOPY); + + // Clean up + Windows.DeleteObject(Windows.SelectObject(ObjectDC, OldAndObjectBitmap)); + Windows.DeleteObject(Windows.SelectObject(MemDC, OldAndMemBitmap)); + Windows.DeleteObject(Windows.SelectObject(SourceDC, OldSourceBitmap)); + Windows.DeleteDC(MemDC); + Windows.DeleteDC(ObjectDC); + Windows.DeleteDC(SourceDC); +end; + + +procedure TGDICanvas.DoDrawImageRect(AImage: TFCustomImage; ASourceRect: TRect; + const ADestPos: TPoint); +var + MemDC: HDC; + OldBitmap: HBITMAP; + GDIPal: array of PRGBQUAD; + i: Integer; +begin + ASSERT(AImage.InheritsFrom(TGDIImage)); + {$IFDEF Debug} + ASSERT(not TGDIImage(AImage).IsLocked); + {$ENDIF} + + MemDC := Windows.CreateCompatibleDC(Handle); + OldBitmap := Windows.SelectObject(MemDC, TGDIImage(AImage).Handle); + + // Set the color palette, if present + if Assigned(AImage.Palette) then + begin + GetMem(GDIPal, AImage.Palette.EntryCount * SizeOf(RGBQUAD)); + for i := 0 to AImage.Palette.EntryCount - 1 do + with AImage.Palette.Entries[i] do + begin + GDIPal[i].rgbRed := Red div 257; + GDIPal[i].rgbGreen := Green div 257; + GDIPal[i].rgbBlue := Blue div 257; + GDIPal[i].rgbReserved := 0; + end; + Windows.SetDIBColorTable(MemDC, 0, AImage.Palette.EntryCount, GDIPal[0]^); + FreeMem(GDIPal); + end; + + with ASourceRect do + Windows.BitBlt(Handle, ADestPos.x, ADestPos.y, Right - Left, Bottom - Top, + MemDC, Left, Top, SRCCOPY); + + Windows.SelectObject(MemDC, OldBitmap); + Windows.DeleteDC(MemDC); +end; + + +procedure TGDICanvas.NeedBrush; +begin + if (FBrush = 0) or (FBrushColor <> FColor) then + begin + if FBrush <> 0 then + begin + Windows.SelectObject(Handle, FOldBrush); + Windows.DeleteObject(FBrush); + end; + FBrushColor := FColor; + FBrush := Windows.CreateSolidBrush(FBrushColor); + FOldBrush := Windows.SelectObject(Handle, FBrush); + end; +end; + + +procedure TGDICanvas.NeedPen; +begin + if (FPen = 0) or (FPenColor <> FColor) or (FPenLineStyle <> FLineStyle) then + begin + if FPen <> 0 then + begin + Windows.SelectObject(Handle, FOldPen); + Windows.DeleteObject(FPen); + end; + FPenColor := FColor; + FPenLineStyle := FLineStyle; + case FPenLineStyle of + lsSolid: + FPen := Windows.CreatePen(PS_SOLID, 0, FPenColor); + end; + FOldPen := Windows.SelectObject(Handle, FPen); + end; +end; + + +procedure TGDICanvas.NeedFont(ANeedFontColor: Boolean); +begin + if FCurFontHandle <> FFontHandle then + begin + Windows.SelectObject(Handle, FFontHandle); + { TODO : Store the font metrics in TGDIFont } + Windows.GetTextMetrics(Handle, @FFontMetrics); + FCurFontHandle := FFontHandle; + end; + if ANeedFontColor then + NeedFontColor; +end; + + +procedure TGDICanvas.NeedFontColor; +begin + if FFontColor <> FColor then + begin + FFontColor := FColor; + Windows.SetTextColor(Handle, FFontColor); + end; +end; + + +procedure TGDICanvas.Resized(NewWidth, NewHeight: Integer); +begin + FWidth := NewWidth; + FHeight := NewHeight; +end; + + +{ TGDIWindowCanvas } + +constructor TGDIWindowCanvas.Create(AWnd: HWND); +begin + FWnd := AWnd; + inherited Create(Windows.GetDC(FWnd)); +end; + + +destructor TGDIWindowCanvas.Destroy; +begin + inherited Destroy; + if Handle <> 0 then + Windows.ReleaseDC(FWnd, Handle); +end; + + +{ TGDIBitmapCanvas } + +constructor TGDIBitmapCanvas.Create(ABitmap: HBITMAP; AWidth, AHeight: Integer); +begin + ASSERT(ABitmap <> 0); + FBitmap := ABitmap; + inherited Create(Windows.CreateCompatibleDC(0)); + FWidth := AWidth; + FHeight := AHeight; + FOldBitmap := Windows.SelectObject(Handle, Bitmap); +end; + + +destructor TGDIBitmapCanvas.Destroy; +begin + Windows.SelectObject(Handle, FOldBitmap); + Windows.DeleteObject(Bitmap); + Windows.DeleteDC(Handle); + inherited Destroy; +end; + + +{ TGDIImage } + +constructor TGDIImage.Create(AWidth, AHeight: Integer; APixelFormat: TGfxPixelFormat); +var + BitmapInfo: PBitmapInfo; + Color: PRGBQUAD; + TempDC: HDC; +begin + inherited Create(AWidth, AHeight, APixelFormat); + + case APixelFormat.FormatType of + ftMono: + begin + FStride := (AWidth + 7) shr 3; + GetMem(BitmapInfo, SizeOf(TBitmapInfoHeader) + 2 * SizeOf(RGBQUAD)); + BitmapInfo^.bmiHeader.biClrUsed := 2; + Color := @BitmapInfo^.bmiColors[0]; + Color^.rgbRed := 0; + Color^.rgbGreen := 0; + Color^.rgbBlue := 0; + Color^.rgbReserved := 0; + Inc(Color); + Color^.rgbRed := 255; + Color^.rgbGreen := 255; + Color^.rgbBlue := 255; + Color^.rgbReserved := 0; + end; + ftPal4, ftPal4A: + begin + FStride := (AWidth + 1) shr 1; + GetMem(BitmapInfo, SizeOf(TBitmapInfoHeader) + 16 * SizeOf(RGBQUAD)); + BitmapInfo^.bmiHeader.biClrUsed := 0; + end; + ftPal8, ftPal8A: + begin + FStride := AWidth; + GetMem(BitmapInfo, SizeOf(TBitmapInfoHeader) + 256 * SizeOf(RGBQUAD)); + BitmapInfo^.bmiHeader.biClrUsed := 0; + end; + else + begin + FStride := AWidth * (FormatTypeBPPTable[APixelFormat.FormatType] shr 3); + GetMem(BitmapInfo, SizeOf(TBitmapInfoHeader)); + BitmapInfo^.bmiHeader.biClrUsed := 0; + end; + end; + // The stride is always a multiple of 4 + FStride := (FStride + 3) and not 3; + + with BitmapInfo^.bmiHeader do + begin + biSize := SizeOf(TBitmapInfoHeader); + biWidth := AWidth; + biHeight := AHeight; + biPlanes := 1; + biBitCount := FormatTypeBPPTable[APixelFormat.FormatType]; + biCompression := 0; + biSizeImage := 4 * AHeight * AWidth; + biXPelsPerMeter := 0; + biYPelsPerMeter := 0; + biClrImportant := 0; + end; + + FData := nil; + + TempDC := GetDC(0); + FHandle := Windows.CreateDIBSection(TempDC, BitmapInfo^, DIB_RGB_COLORS, FData, 0, 0); + ReleaseDC(0, TempDC); + + FreeMem(BitmapInfo); +end; + + +destructor TGDIImage.Destroy; +begin + if Handle <> 0 then + Windows.DeleteObject(Handle); + inherited Destroy; +end; + + +procedure TGDIImage.Lock(var AData: Pointer; var AStride: LongWord); +begin + ASSERT(not IsLocked); + IsLocked := True; + AData := Data; + AStride := Stride; + Windows.GdiFlush; +end; + +procedure TGDIImage.Unlock; +begin + ASSERT(IsLocked); + IsLocked := False; +end; + + +{ TGDIScreen } + +constructor TGDIScreen.Create; +begin + inherited Create; + +end; + +{ TGDIApplication } + +constructor TGDIApplication.Create; +begin + inherited Create; + +end; + + +destructor TGDIApplication.Destroy; +var + i: Integer; +begin + for i := 0 to Forms.Count - 1 do + TGDIWindow(Forms[i]).Free; + + inherited Destroy; +end; + +procedure TGDIApplication.AddWindow(AWindow: TFCustomWindow); +begin + Forms.Add(AWindow); +end; + + +procedure TGDIApplication.Initialize(ADisplayName: String); +begin + +end; + +procedure TGDIApplication.Run; +var + Msg: TMsg; +begin + DoBreakRun := False; + + while Windows.GetMessage(@Msg, 0, 0, 0) and + (not (QuitWhenLastWindowCloses and (Forms.Count = 0))) and + (DoBreakRun = False) do + begin + Windows.TranslateMessage(@msg); + Windows.DispatchMessage(@msg); + end; + + DoBreakRun := False; +end; + + +procedure TGDIApplication.Quit; +begin + DoBreakRun := True; +end; + + +{ TGDIWindow } + +function fpGFXWindowProc(hwnd: HWND; uMsg: UINT; wParam: WPARAM; + lParam: LPARAM): LRESULT; stdcall; +var + Window: TGDIWindow; + Msg: TMessage; +begin + if uMsg = WM_CREATE then + begin + Window := TGDIWindow(PCreateStruct(lParam)^.lpCreateParams); + Window.FHandle := hwnd; + Windows.SetWindowLong(hwnd, GWL_USERDATA, LongWord(Window)); + end else + Window := TGDIWindow(Windows.GetWindowLong(hwnd, GWL_USERDATA)); + + if Assigned(Window) then + begin + Msg.msg := uMsg; + Msg.wParam := wParam; + Msg.lParam := lParam; + Msg.Result := 0; + Window.Dispatch(Msg); + Result := Msg.Result; + end + else + if UnicodeEnabledOS then Result := Windows.DefWindowProcW(hwnd, uMsg, wParam, lParam) + else Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam); +end; + + +constructor TGDIWindow.Create(AParent: TFCustomWindow; AWindowOptions: TGfxWindowOptions); +var + ParentHandle: HWND; +begin + inherited Create; + + FWindowOptions := AWindowOptions; + FParent := AParent; + + { Initialize a window class, if necessary } + if UnicodeEnabledOS then + begin + if not Assigned(WindowClassW.lpfnWndProc) then + begin + WindowClassW.style := CS_HREDRAW or CS_VREDRAW; + WindowClassW.lpfnWndProc := WndProc(@fpGFXWindowProc); + WindowClassW.hInstance := MainInstance; + WindowClassW.hIcon := LoadIcon(0, IDI_APPLICATION); + WindowClassW.hCursor := LoadCursor(0, IDC_ARROW); + WindowClassW.hbrBackground := 0; + WindowClassW.lpszClassName := 'fpGFX'; + end; + Windows.RegisterClassW(@WindowClassW); + end + else + begin + if not Assigned(WindowClass.lpfnWndProc) then + begin + WindowClass.style := CS_HREDRAW or CS_VREDRAW; + WindowClass.lpfnWndProc := WndProc(@fpGFXWindowProc); + WindowClass.hInstance := MainInstance; + WindowClass.hIcon := LoadIcon(0, IDI_APPLICATION); + WindowClass.hCursor := LoadCursor(0, IDC_ARROW); + WindowClass.hbrBackground := 0; + WindowClass.lpszClassName := 'fpGFX'; + end; + Windows.RegisterClass(@WindowClass); + end; + + if Assigned(AParent) then + ParentHandle := AParent.Handle + else + ParentHandle := 0; + + if (woBorderless in FWindowOptions) and (woPopUp in FWindowOptions) then FWindowStyle := WS_POPUP + else if woPopUp in FWindowOptions then FWindowStyle := WS_POPUPWINDOW + else if woToolWindow in FWindowOptions then FWindowStyle := WS_OVERLAPPED + else if woChildWindow in FWindowOptions then FWindowStyle := WS_CHILDWINDOW + else if woBorderless in FWindowOptions then FWindowStyle := WS_OVERLAPPED + else if woWindow in FWindowOptions then FWindowStyle := WS_OVERLAPPEDWINDOW + else FWindowStyle := 0; + + if woPopUp in FWindowOptions then FWindowStyleEx := WS_EX_TOOLWINDOW + else if woToolWindow in FWindowOptions then FWindowStyleEx := WS_EX_TOOLWINDOW + else if woWindow in FWindowOptions then FWindowStyleEx := WS_EX_APPWINDOW + else FWindowStyleEx := 0; + + if UnicodeEnabledOS then + FHandle := Windows.CreateWindowExW( + FWindowStyleEx, // extended window style + 'fpGFX', // registered class name + 'fpGFX Window', // window name + FWindowStyle, // window style + CW_USEDEFAULT, // horizontal position of window + CW_USEDEFAULT, // vertical position of window + CW_USEDEFAULT, // window width + CW_USEDEFAULT, // window height + ParentHandle, // handle to parent or owner window + 0, // menu handle or child identifier + MainInstance, // handle to application instance + Self) // window-creation data + else + FHandle := Windows.CreateWindowEx( + FWindowStyleEx, // extended window style + 'fpGFX', // registered class name + 'fpGFX Window', // window name + FWindowStyle, // window style + CW_USEDEFAULT, // horizontal position of window + CW_USEDEFAULT, // vertical position of window + CW_USEDEFAULT, // window width + CW_USEDEFAULT, // window height + ParentHandle, // handle to parent or owner window + 0, // menu handle or child identifier + MainInstance, // handle to application instance + Self); // window-creation data + + FCanvas := TGDIWindowCanvas.Create(Handle); +end; + + +destructor TGDIWindow.Destroy; +var + OldHandle: HWND; +begin + if Assigned(OnClose) then + OnClose(Self); + + Canvas.Free; + + if Handle <> 0 then + begin + OldHandle := Handle; + FHandle := 0; + Windows.DestroyWindow(OldHandle); + end; + + gApplication.Forms.Remove(Self); + + // Are we the last window for our owning display? + if gApplication.Forms.Count = 0 then + Windows.PostQuitMessage(0); + + inherited Destroy; +end; + + +procedure TGDIWindow.DefaultHandler(var Message); +begin + if UnicodeEnabledOS then + TMessage(Message).Result := Windows.DefWindowProcW(Handle, + TMessage(Message).Msg, TMessage(Message).wParam, TMessage(Message).lParam) + else + TMessage(Message).Result := Windows.DefWindowProc(Handle, + TMessage(Message).Msg, TMessage(Message).wParam, TMessage(Message).lParam) +end; + + +procedure TGDIWindow.SetPosition(const APosition: TPoint); +begin + Windows.SetWindowPos(Handle, 0, APosition.x, APosition.y, 0, 0, + SWP_NOSIZE or SWP_NOZORDER); +end; + + +procedure TGDIWindow.SetSize(const ASize: TSize); +begin + if (ASize.cx <> Width) or (ASize.cy <> Height) then + Windows.SetWindowPos(Handle, 0, 0, 0, ASize.cx, ASize.cy, + SWP_NOMOVE or SWP_NOZORDER); +end; + + +procedure TGDIWindow.SetMinMaxSize(const AMinSize, AMaxSize: TSize); +begin + FMinSize := AMinSize; + FMaxSize := AMaxSize; + UpdateWindowButtons; +end; + + +procedure TGDIWindow.SetClientSize(const ASize: TSize); +var + r: Windows.Rect; +begin + if (ASize.cx <> ClientWidth) or (ASize.cx <> ClientHeight) then + begin + r.Left := 0; + r.Top := 0; + r.Right := ASize.cx; + r.Bottom := ASize.cy; + Windows.AdjustWindowRectEx(r, FWindowStyle, False, FWindowStyleEx); + SetSize(Size(WinRectToRect(r))); + end; +end; + + +procedure TGDIWindow.SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); +var + Rect: Windows.Rect; +begin + Rect.Left := 0; + Rect.Top := 0; + Rect.Right := AMinSize.cx; + Rect.Bottom := AMinSize.cy; + Windows.AdjustWindowRectEx(Rect, FWindowStyle, False, FWindowStyleEx); + if AMinSize.cx > 0 then + FMinSize.cx := Rect.Right - Rect.Left + else + FMinSize.cx := 0; + if AMinSize.cy > 0 then + FMinSize.cy := Rect.Bottom - Rect.Top + else + FMinSize.cy := 0; + + Rect.Left := 0; + Rect.Top := 0; + Rect.Right := AMaxSize.cx; + Rect.Bottom := AMaxSize.cy; + Windows.AdjustWindowRectEx(Rect, FWindowStyle, False, FWindowStyleEx); + if AMaxSize.cx > 0 then + FMaxSize.cx := Rect.Right - Rect.Left + else + FMaxSize.cx := 0; + if AMaxSize.cy > 0 then + FMaxSize.cy := Rect.Bottom - Rect.Top + else + FMaxSize.cy := 0; + + UpdateWindowButtons; +end; + + +procedure TGDIWindow.Show; +begin + Windows.ShowWindow(Handle, SW_SHOWNORMAL); + Windows.UpdateWindow(Handle); +end; + + +procedure TGDIWindow.Invalidate(const ARect: TRect); +var + Rect: Windows.Rect; +begin + Rect.Left := ARect.Left; + Rect.Top := ARect.Top; + Rect.Right := ARect.Right; + Rect.Bottom := ARect.Bottom; + Windows.InvalidateRect(Handle, Rect, False); +end; + + +procedure TGDIWindow.PaintInvalidRegion; +begin + Windows.UpdateWindow(Handle); +end; + + +procedure TGDIWindow.CaptureMouse; +begin + if FHasMouseCapture then + exit; + + FHasMouseCapture := True; + + if not FMouseInWindow then + begin + FMouseInWindow := True; + Windows.SetCapture(Handle); + end; +end; + + +procedure TGDIWindow.ReleaseMouse; +begin + if FHasMouseCapture then + begin + FHasMouseCapture := False; + if not FMouseInWindow then + begin + Windows.ReleaseCapture; + end; + end; +end; + + +function TGDIWindow.GetTitle: String; +var + TextLen: Integer; + AnsiBuffer: string; + WideBuffer: WideString; +begin + if UnicodeEnabledOS then + begin + TextLen := Windows.GetWindowTextLengthW(Handle); + SetLength(WideBuffer, TextLen); + TextLen := Windows.GetWindowTextW(Handle, @WideBuffer[1], TextLen + 1); + SetLength(WideBuffer, TextLen); + Result := Utf8Encode(WideBuffer); + end + else + begin + TextLen := Windows.GetWindowTextLength(Handle); + SetLength(AnsiBuffer, TextLen); + TextLen := Windows.GetWindowText(Handle, @AnsiBuffer[1], TextLen + 1); + SetLength(AnsiBuffer, TextLen); + Result := AnsiToUtf8(AnsiBuffer); + end; +end; + +procedure TGDIWindow.SetTitle(const ATitle: String); +begin + if UnicodeEnabledOS then + Windows.SetWindowTextW(Handle, PWideChar(Utf8Decode(ATitle))) + else Windows.SetWindowText(Handle, PChar(Utf8ToAnsi(ATitle))); +end; + + +procedure TGDIWindow.DoSetCursor; +const + CursorTable: array[TGfxCursor] of Integer = ( + 32512, // crDefault + 0, // crNone + 32512, // crArrow + 32515, // crCross + 32513, // crIBeam + 32646, // crSize + 32645, // crSizeNS + 32644, // crSizeWE + 32516, // crUpArrow + 32514, // crHourGlass + 32648, // crNoDrop + 32651); // crHelp +var + ID: Integer; +begin + if FMouseInWindow then + begin + ID := CursorTable[Cursor]; + if ID <> 0 then + Windows.SetCursor(Windows.LoadCursor(0, MAKEINTRESOURCE(ID))) + else + Windows.SetCursor(0); + end; +end; + + +procedure TGDIWindow.UpdateWindowButtons; +var + CanMaximize: Boolean; +begin + if woWindow in FWindowOptions then + begin + CanMaximize := (FMaxSize.cx = 0) or (FMaxSize.cy = 0) or + (FMaxSize.cx > FMinSize.cx) or (FMaxSize.cy > FMinSize.cy); + + if CanMaximize and ((FWindowStyle and WS_MAXIMIZEBOX) = 0) then + FWindowStyle := FWindowStyle or WS_MAXIMIZEBOX + else if (not CanMaximize) and + ((FWindowStyle and WS_MAXIMIZEBOX) <> 0) then + FWindowStyle := FWindowStyle and not WS_MAXIMIZEBOX; + + Windows.SetWindowLong(Handle, GWL_STYLE, FWindowStyle or + (Windows.GetWindowLong(Handle, GWL_STYLE) and + (WS_MAXIMIZE or WS_MINIMIZE or WS_VISIBLE))); // preserver these bits! + end; +end; + + +function WindowFromPoint(x, y: Windows.LONG):Windows.HWND; external 'user32' name 'WindowFromPoint'; + + +function TGDIWindow.DoMouseEnterLeaveCheck(const Msg: TMessage): Boolean; + + function CursorInDifferentWindow: Boolean; + var + pt: Windows.POINT; + begin + pt.x := Msg.lParamLo; + pt.y := Msg.lParamHi; + + // only WM_MOUSEWHEEL uses screen coordinates!!! + if Msg.Msg <> WM_MOUSEWHEEL then + Windows.ClientToScreen(Handle, pt); + + Result := WindowFromPoint(pt.x, pt.y) <> Handle; +{!!!: Result := Windows.WindowFromPoint(pt) <> Handle;} + end; + +var + pt: Windows.POINT; +begin + if not FMouseInWindow then + begin + FMouseInWindow := True; + DoSetCursor; + Windows.SetCapture(Handle); + if Assigned(OnMouseEnter) then + OnMouseEnter(Self, GetKeyboardShiftState, + Point(Msg.lParamLo, Msg.lParamHi)); + Result := Msg.Msg <> WM_MOUSEMOVE; + end else + begin + pt.x := Msg.lParamLo; + pt.y := Msg.lParamHi; + if Msg.Msg = WM_MOUSEWHEEL then + Windows.ScreenToClient(Handle, pt); + if (pt.x < 0) or (pt.y < 0) or (pt.x >= ClientWidth) or + (pt.y >= ClientHeight) or CursorInDifferentWindow then + FMouseInWindow := False; + + if (not FHasMouseCapture) and (not FMouseInWindow) then + begin + Windows.ReleaseCapture; + if Assigned(OnMouseLeave) then + OnMouseLeave(Self); + Result := False; + end else + Result := True; + end; +end; + + +// private methods + +procedure TGDIWindow.WMCreate(var Msg: TMessage); +begin + if Assigned(OnCreate) then + OnCreate(Self); +end; + + +procedure TGDIWindow.WMDestroy(var Msg: TMessage); +begin + if Handle <> 0 then + Self.Free; +end; + + +procedure TGDIWindow.WMGetMinMaxInfo(var Msg: TMessage); +begin + with PMinMaxInfo(Msg.lParam)^ do + begin + if FMinSize.cx > 0 then + ptMinTrackSize.x := FMinSize.cx; + if FMinSize.cy > 0 then + ptMinTrackSize.y := FMinSize.cy; + if FMaxSize.cx > 0 then + ptMaxTrackSize.x := FMaxSize.cx; + if FMaxSize.cy > 0 then + ptMaxTrackSize.y := FMaxSize.cy; + end; +end; + + +procedure TGDIWindow.WMActivate(var Msg: TMessage); +begin + if Msg.wParam = WA_INACTIVE then + begin + FHasFocus := False; + if Assigned(OnFocusOut) then + OnFocusOut(Self); + end else + begin + FHasFocus := True; + if Assigned(OnFocusIn) then + OnFocusIn(Self); + end; +end; + + +procedure TGDIWindow.WMPaint(var Msg: TMessage); +var + PaintStruct: TPaintStruct; + r: TRect; + OldCanvas: TFCustomCanvas; +begin + Windows.BeginPaint(Handle, @PaintStruct); + if Assigned(OnPaint) then + begin + with PaintStruct.rcPaint do + begin + r.Left := Left; + r.Top := Top; + r.Right := Right; + r.Bottom := Bottom; + end; + OldCanvas := Canvas; + FCanvas := TGDICanvas.Create(PaintStruct.hdc); + OnPaint(Self, r); + Canvas.Free; + FCanvas := OldCanvas; + end; + Windows.EndPaint(Handle, @PaintStruct); +end; + + +procedure TGDIWindow.WMShowWindow(var Msg: TMessage); +begin + if Msg.wParam <> 0 then + begin + if Assigned(OnFocusIn) then + OnFocusIn(Self); + if Assigned(OnShow) then + OnShow(Self); + end else + if Assigned(OnHide) then + OnHide(Self); +end; + + +procedure TGDIWindow.WMMove(var Msg: TMessage); +begin + if (Msg.lParamLo <> Left) or (Msg.lParamHi <> Top) then + begin + FLeft := Msg.lParamLo; + FTop := Msg.lParamHi; + if Assigned(OnMove) then + OnMove(Self); + end; +end; + + +procedure TGDIWindow.WMSize(var Msg: TMessage); +var + r: Windows.Rect; +begin + if (Msg.lParamLo <> ClientWidth) or (Msg.lParamHi <> ClientHeight) then + begin + Windows.GetWindowRect(Handle, r); + FWidth := r.Right - r.Left; + FHeight := r.Bottom - r.Top; + Windows.GetClientRect(Handle, r); + FClientWidth := Msg.lParamLo; + FClientHeight := Msg.lParamHi; + TGDICanvas(Canvas).Resized(FWidth, FHeight); + if Assigned(OnResize) then + OnResize(Self); + end; +end; + + +procedure TGDIWindow.WMLButtonDown(var Msg: TMessage); +begin + if FMouseInWindow and not FHasFocus then + Windows.SetActiveWindow(Handle); + if DoMouseEnterLeaveCheck(Msg) and Assigned(OnMousePressed) then + OnMousePressed(Self, mbLeft, GetKeyboardShiftState, + Point(Msg.lParamLo, Msg.lParamHi)); +end; + + +procedure TGDIWindow.WMLButtonUp(var Msg: TMessage); +begin + if DoMouseEnterLeaveCheck(Msg) and Assigned(OnMouseReleased) then + OnMouseReleased(Self, mbLeft, GetKeyboardShiftState, + Point(Msg.lParamLo, Msg.lParamHi)); +end; + + +procedure TGDIWindow.WMRButtonDown(var Msg: TMessage); +begin + if FMouseInWindow and not FHasFocus then + Windows.SetActiveWindow(Handle); + if DoMouseEnterLeaveCheck(Msg) and Assigned(OnMousePressed) then + OnMousePressed(Self, mbRight, GetKeyboardShiftState, + Point(Msg.lParamLo, Msg.lParamHi)); +end; + + +procedure TGDIWindow.WMRButtonUp(var Msg: TMessage); +begin + if DoMouseEnterLeaveCheck(Msg) and Assigned(OnMouseReleased) then + OnMouseReleased(Self, mbRight, GetKeyboardShiftState, + Point(Msg.lParamLo, Msg.lParamHi)); +end; + + +procedure TGDIWindow.WMMButtonDown(var Msg: TMessage); +begin + if FMouseInWindow and not FHasFocus then + Windows.SetActiveWindow(Handle); + if DoMouseEnterLeaveCheck(Msg) and Assigned(OnMousePressed) then + OnMousePressed(Self, mbMiddle, GetKeyboardShiftState, + Point(Msg.lParamLo, Msg.lParamHi)); +end; + +procedure TGDIWindow.WMMButtonUp(var Msg: TMessage); +begin + if DoMouseEnterLeaveCheck(Msg) and Assigned(OnMouseReleased) then + OnMouseReleased(Self, mbMiddle, GetKeyboardShiftState, + Point(Msg.lParamLo, Msg.lParamHi)); +end; + +procedure TGDIWindow.WMMouseMove(var Msg: TMessage); +begin + if DoMouseEnterLeaveCheck(Msg) and Assigned(OnMouseMove) then + OnMouseMove(Self, GetKeyboardShiftState, Point(Msg.lParamLo, Msg.lParamHi)); +end; + +procedure TGDIWindow.WMMouseWheel(var Msg: TMessage); +var + pt: Windows.POINT; +begin + if DoMouseEnterLeaveCheck(Msg) and Assigned(OnMouseWheel) then + begin + pt.x := Msg.lParamLo; + pt.y := Msg.lParamHi; + Windows.ScreenToClient(Handle, pt); + OnMouseWheel(Self, GetKeyboardShiftState, SmallInt(Msg.wParamHi) / -120.0, + Point(pt.x, pt.y)); + end; +end; + +procedure TGDIWindow.WMKeyDown(var Msg: TMessage); +begin + if Assigned(OnKeyPressed) then + OnKeyPressed(Self, VirtKeyToKeycode(Msg.wParam), GetKeyboardShiftState); + if (Msg.wParam = $2e {VK_DELETE}) and Assigned(OnKeyChar) then + OnKeyChar(Self, #127); +end; + +procedure TGDIWindow.WMKeyUp(var Msg: TMessage); +begin + if Assigned(OnKeyReleased) then + OnKeyReleased(Self, VirtKeyToKeycode(Msg.wParam), GetKeyboardShiftState); +end; + +procedure TGDIWindow.WMChar(var Msg: TMessage); +begin + if Assigned(OnKeyChar) then + OnKeyChar(Self, Chr(Msg.wParam)); +end; + +procedure TGDIWindow.WMSysKeyDown(var Msg: TMessage); +begin + WMKeyDown(Msg); +end; + +procedure TGDIWindow.WMSysKeyUp(var Msg: TMessage); +begin + WMKeyUp(Msg); +end; + +procedure TGDIWindow.WMSysChar(var Msg: TMessage); +begin + WMChar(Msg); +end; + + +{ Helpers } + +function RectToWinRect(const ARect: TRect): Windows.Rect; +begin + Result.Left := ARect.Left; + Result.Top := ARect.Top; + Result.Right := ARect.Right; + Result.Bottom := ARect.Bottom; +end; + +function WinRectToRect(const ARect: Windows.Rect): TRect; +begin + Result.Left := ARect.Left; + Result.Top := ARect.Top; + Result.Right := ARect.Right; + Result.Bottom := ARect.Bottom; +end; + + +{$INCLUDE gdikeys.inc} + +initialization + + WinVersion.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); + GetVersionEx(WinVersion); + + UnicodeEnabledOS := (WinVersion.dwPlatformID = VER_PLATFORM_WIN32_NT) + or (WinVersion.dwPlatformID = VER_PLATFORM_WIN32_CE); + +end. + diff --git a/gfx/gdi/gfxinterface.pas b/gfx/gdi/gfxinterface.pas new file mode 100644 index 00000000..976160b7 --- /dev/null +++ b/gfx/gdi/gfxinterface.pas @@ -0,0 +1,39 @@ +{ + fpGUI - Free Pascal GUI Library + + GFXInterface - Default target selection unit for Windows GDI target + + Copyright (C) 2000 - 2006 See the file AUTHORS, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + 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. +} +unit GFXInterface; + +interface + +uses GFX_GDI; + +type + + TDefFont = TGDIFont; + + TDefCanvas = TGDICanvas; + + TDefImage = TGDIImage; + + TDefScreen = TGDIScreen; + + TDefApplication = TGDIApplication; + + TDefWindow = TGDIWindow; + +implementation + +end. + diff --git a/gfx/gfxbase.pas b/gfx/gfxbase.pas new file mode 100644 index 00000000..dd1f305e --- /dev/null +++ b/gfx/gfxbase.pas @@ -0,0 +1,1283 @@ +{ + fpGUI - Free Pascal GUI Library + + GFXBase - Abstract declarations to be implemented on each platform + + Copyright (C) 2000 - 2006 See the file AUTHORS, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + 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. +} +unit GfxBase; + +{$IFDEF Debug} + {$ASSERTIONS On} +{$ENDIF} + +{$ifdef fpc} + {$mode objfpc}{$H+} +{$endif} + +interface + +uses + SysUtils, + Classes; + +{$INCLUDE keys.inc} + +resourcestring + // Exception message strings, to be used by target implementations + SUnsupportedPixelFormat = 'Pixel format (%d bits/pixel) is not supported'; + SIncompatibleCanvasForBlitting = 'Cannot blit from %s to %s'; + +type + + TSize = record + cx, cy: Integer; + end; + + + { We use a special 3x3 matrix for transformations of coordinates. As the + only allowed transformations are translations and scalations, we need a + matrix with the following content ([x,y] is a variable): + [0,0] 0 [2,0] + 0 [1,1] [2,1] + 0 0 1 + [0,0]: X scalation + [2,0]: X translation + [1,1]: Y scalation + [2,1]: Y translation + NOTE: This may change in the future! Don't assume anything about the + structure of TGfxMatrix! TGfxCanvas only allows you to read and + write the current transformation matrix so that the matrix can + easily be saved and restored. + } + + TGfxMatrix = record + _00, _20, _11, _21: Integer; + end; + +const + GfxIdentityMatrix: TGfxMatrix = (_00: 1; _20: 0; _11: 1; _21: 0); + +type + + PGfxColor = ^TGfxColor; + TGfxColor = packed record + Red, Green, Blue, Alpha: Word; + end; + + PGfxPixel = ^TGfxPixel; + TGfxPixel = LongWord; + + + TGfxFormatType = ( + ftInvalid, + ftMono, // Monochrome + ftPal4, // 4 bpp using palette + ftPal4A, // 4 bpp using palette with alpha values > 0 + ftPal8, // 8 bpp using palette + ftPal8A, // 8 bpp using palette with alpha values > 0 + ftRGB16, // 15/16 bpp RGB + ftRGBA16, // 16 bpp RGBA + ftRGB24, // 24 bpp RGB + ftRGB32, // 32 bpp RGB + ftRGBA32); // 32 bpp RGBA + + + TGfxPixelFormat = record + case FormatType: TGfxFormatType of + ftRGB16, ftRGBA16, ftRGB24, ftRGB32, ftRGBA32: ( + RedMask: TGfxPixel; + GreenMask: TGfxPixel; + BlueMask: TGfxPixel; + AlphaMask: TGfxPixel); // only used for RGBA types + end; + + +const + + FormatTypeBPPTable: array[TGfxFormatType] of Integer = + (0, 1, 4, 4, 8, 8, 16, 16, 24, 32, 32); + + { Predefined colors } + + colTransparent: TGfxColor = (Red: $0000; Green: $0000; Blue: $0000; Alpha: $ffff); + colBlack: TGfxColor = (Red: $0000; Green: $0000; Blue: $0000; Alpha: $0000); + colBlue: TGfxColor = (Red: $0000; Green: $0000; Blue: $ffff; Alpha: $0000); + colGreen: TGfxColor = (Red: $0000; Green: $ffff; Blue: $0000; Alpha: $0000); + colCyan: TGfxColor = (Red: $0000; Green: $ffff; Blue: $ffff; Alpha: $0000); + colRed: TGfxColor = (Red: $ffff; Green: $0000; Blue: $0000; Alpha: $0000); + colMagenta: TGfxColor = (Red: $ffff; Green: $0000; Blue: $ffff; Alpha: $0000); + colYellow: TGfxColor = (Red: $ffff; Green: $ffff; Blue: $0000; Alpha: $0000); + colWhite: TGfxColor = (Red: $ffff; Green: $ffff; Blue: $ffff; Alpha: $0000); + colGray: TGfxColor = (Red: $8000; Green: $8000; Blue: $8000; Alpha: $0000); + colLtGray: TGfxColor = (Red: $c000; Green: $c000; Blue: $c000; Alpha: $0000); + colDkBlue: TGfxColor = (Red: $0000; Green: $0000; Blue: $8000; Alpha: $0000); + colDkGreen: TGfxColor = (Red: $0000; Green: $8000; Blue: $0000; Alpha: $0000); + colDkCyan: TGfxColor = (Red: $0000; Green: $8000; Blue: $8000; Alpha: $0000); + colDkRed: TGfxColor = (Red: $8000; Green: $0000; Blue: $0000; Alpha: $0000); + colDkMagenta: TGfxColor = (Red: $8000; Green: $0000; Blue: $8000; Alpha: $0000); + colDkYellow: TGfxColor = (Red: $8000; Green: $8000; Blue: $0000; Alpha: $0000); + + webBlack: TGfxColor = (Red: $0000; Green: $0000; Blue: $0000; Alpha: $0000); + webMaroon: TGfxColor = (Red: $8000; Green: $0000; Blue: $0000; Alpha: $0000); + webGreen: TGfxColor = (Red: $0000; Green: $8000; Blue: $0000; Alpha: $0000); + webOlive: TGfxColor = (Red: $8000; Green: $8000; Blue: $0000; Alpha: $0000); + webNavy: TGfxColor = (Red: $0000; Green: $0000; Blue: $8000; Alpha: $0000); + webPurple: TGfxColor = (Red: $8000; Green: $0000; Blue: $8000; Alpha: $0000); + webTeal: TGfxColor = (Red: $0000; Green: $8000; Blue: $8000; Alpha: $0000); + webGray: TGfxColor = (Red: $8000; Green: $8000; Blue: $8000; Alpha: $0000); + webSilver: TGfxColor = (Red: $c000; Green: $c000; Blue: $c000; Alpha: $0000); + webRed: TGfxColor = (Red: $ffff; Green: $0000; Blue: $0000; Alpha: $0000); + webLime: TGfxColor = (Red: $0000; Green: $ffff; Blue: $0000; Alpha: $0000); + webYellow: TGfxColor = (Red: $ffff; Green: $ffff; Blue: $0000; Alpha: $0000); + webBlue: TGfxColor = (Red: $0000; Green: $0000; Blue: $ffff; Alpha: $0000); + webFuchsia: TGfxColor = (Red: $ffff; Green: $0000; Blue: $ffff; Alpha: $0000); + webAqua: TGfxColor = (Red: $0000; Green: $ffff; Blue: $ffff; Alpha: $0000); + webWhite: TGfxColor = (Red: $ffff; Green: $ffff; Blue: $ffff; Alpha: $0000); + + + // Some predefined pixel formats: + + PixelFormatMono: TGfxPixelFormat = ( + FormatType: ftMono; + RedMask: 0; + GreenMask: 0; + BlueMask: 0; + AlphaMask: 0); + + PixelFormatPal4: TGfxPixelFormat = ( + FormatType: ftPal4; + RedMask: 0; + GreenMask: 0; + BlueMask: 0; + AlphaMask: 0); + + PixelFormatPal4A: TGfxPixelFormat = ( + FormatType: ftPal4A; + RedMask: 0; + GreenMask: 0; + BlueMask: 0; + AlphaMask: 0); + + PixelFormatPal8: TGfxPixelFormat = ( + FormatType: ftPal8; + RedMask: 0; + GreenMask: 0; + BlueMask: 0; + AlphaMask: 0); + + PixelFormatPal8A: TGfxPixelFormat = ( + FormatType: ftPal8A; + RedMask: 0; + GreenMask: 0; + BlueMask: 0; + AlphaMask: 0); + + PixelFormatRGB24: TGfxPixelFormat = ( + FormatType: ftRGB24; + RedMask: $0000ff; + GreenMask: $00ff00; + BlueMask: $ff0000; + AlphaMask: 0); + + PixelFormatBGR24: TGfxPixelFormat = ( + FormatType: ftRGB24; + RedMask: $ff0000; + GreenMask: $00ff00; + BlueMask: $0000ff; + AlphaMask: 0); + + PixelFormatRGB32: TGfxPixelFormat = ( + FormatType: ftRGB32; + RedMask: $0000ff; + GreenMask: $00ff00; + BlueMask: $ff0000; + AlphaMask: 0); + + PixelFormatRGBA32: TGfxPixelFormat = ( + FormatType: ftRGB32; + RedMask: $000000ff; + GreenMask: $0000ff00; + BlueMask: $00ff0000; + AlphaMask: $ff000000); + + PixelFormatARGB32: TGfxPixelFormat = ( + FormatType: ftRGB32; + RedMask: $0000ff00; + GreenMask: $00ff0000; + BlueMask: $ff000000; + AlphaMask: $000000ff); + + PixelFormatBGR32: TGfxPixelFormat = ( + FormatType: ftRGB32; + RedMask: $ff0000; + GreenMask: $00ff00; + BlueMask: $0000ff; + AlphaMask: 0); + + PixelFormatBGRA32: TGfxPixelFormat = ( + FormatType: ftRGB32; + RedMask: $00ff0000; + GreenMask: $0000ff00; + BlueMask: $000000ff; + AlphaMask: $ff000000); + + PixelFormatABGR32: TGfxPixelFormat = ( + FormatType: ftRGB32; + RedMask: $ff000000; + GreenMask: $00ff0000; + BlueMask: $0000ff00; + AlphaMask: $000000ff); + +type + + EGfxError = class(Exception); + + EGfxUnsupportedPixelFormat = class(EGfxError) + constructor Create(const APixelFormat: TGfxPixelFormat); + end; + + + TFCustomImage = class; + TFCustomApplication = class; + TFCustomWindow = class; + + TGfxWindowOption = ( + woWindow, woBorderless, woPopup, woToolWindow, woChildWindow, + woX11SkipWMHints); + TGfxWindowOptions = set of TGfxWindowOption; + + TGfxCursor = (crDefault, crNone, crArrow, crCross, crIBeam, crSize, crSizeNS, + crSizeWE, cpUpArrow, crHourGlass, crNoDrop, crHelp); + + + { TFCustomFont } + + TGfxFontClass = (fcSerif, fcSansSerif, fcTypewriter, fcDingbats); + + TFCustomFont = class + protected + FHandle: Cardinal; + public + class function GetDefaultFontName(const AFontClass: TGfxFontClass): String; virtual; + property Handle: Cardinal read FHandle; + end; + + + { TGfxPalette } + + TGfxPalette = class + private + FRefCount: LongInt; + FEntryCount: Integer; + FEntries: PGfxColor; + function GetEntry(AIndex: Integer): TGfxColor; + public + constructor Create(AEntryCount: Integer; AEntries: PGfxColor); + destructor Destroy; override; + procedure AddRef; + procedure Release; + property EntryCount: Integer read FEntryCount; + property Entries[AIndex: Integer]: TGfxColor read GetEntry; + end; + + + { TFCustomCanvas } + + TGfxLineStyle = (lsSolid, lsDot); + + TFCustomCanvas = class(TObject) + private + FMatrix: TGfxMatrix; + protected + FWidth: Integer; + FHeight: Integer; + FPixelFormat: TGfxPixelFormat; + function DoExcludeClipRect(const ARect: TRect): Boolean; virtual; abstract; + function DoIntersectClipRect(const ARect: TRect): Boolean; virtual; abstract; + function DoUnionClipRect(const ARect: TRect): Boolean; virtual; abstract; + function DoGetClipRect: TRect; virtual; abstract; + procedure DoDrawArc(const ARect: TRect; StartAngle, EndAngle: Single); virtual; abstract; + procedure DoDrawCircle(const ARect: TRect); virtual; abstract; + procedure DoDrawLine(const AFrom, ATo: TPoint); virtual; abstract; + procedure DoDrawRect(const ARect: TRect); virtual; + procedure DoDrawPoint(const APoint: TPoint); virtual; abstract; + procedure DoFillRect(const ARect: TRect); virtual; abstract; + procedure DoTextOut(const APosition: TPoint; const AText: String); virtual; abstract; + procedure DoCopyRect(ASource: TFCustomCanvas; const ASourceRect: TRect; const ADestPos: TPoint); virtual; abstract; + procedure DoMaskedCopyRect(ASource, AMask: TFCustomCanvas; const ASourceRect: TRect; const AMaskPos, ADestPos: TPoint); virtual; abstract; + procedure DoDrawImageRect(AImage: TFCustomImage; ASourceRect: TRect; const ADestPos: TPoint); virtual; abstract; + public + constructor Create; + // Transformations + function Transform(APoint: TPoint): TPoint; + function Transform(ARect: TRect): TRect; + function ReverseTransform(APoint: TPoint): TPoint; + function ReverseTransform(ARect: TRect): TRect; + procedure AppendTranslation(ADelta: TPoint); + + // Graphics state + procedure SaveState; virtual; abstract; + procedure RestoreState; virtual; abstract; + procedure EmptyClipRect; virtual; + procedure SetColor_(AColor: TGfxPixel); virtual; abstract; + procedure SetColor(AColor: TGfxColor); virtual; + procedure SetFont(AFont: TFCustomFont); virtual; abstract; + procedure SetLineStyle(ALineStyle: TGfxLineStyle); virtual; abstract; + function ExcludeClipRect(const ARect: TRect): Boolean; + function IntersectClipRect(const ARect: TRect): Boolean; + function UnionClipRect(const ARect: TRect): Boolean; + function GetClipRect: TRect; + function MapColor(const AColor: TGfxColor): TGfxPixel; virtual; abstract; + + // Drawing functions + procedure DrawArc(const ARect: TRect; StartAngle, EndAngle: Single); + procedure DrawCircle(const ARect: TRect); + procedure DrawLine(const AFrom, ATo: TPoint); + procedure DrawPolyLine(const Coords: array of TPoint); virtual; + procedure DrawRect(const ARect: TRect); + procedure DrawPoint(const APoint: TPoint); + procedure FillRect(const ARect: TRect); + + // Fonts + function FontCellHeight: Integer; virtual; abstract; + function TextExtent(const AText: String): TSize; virtual; + function TextWidth(const AText: String): Integer; virtual; + procedure TextOut(const APosition: TPoint; const AText: String); + + // Bit block transfers + procedure Copy(ASource: TFCustomCanvas; const ADestPos: TPoint); virtual; + procedure CopyRect(ASource: TFCustomCanvas; const ASourceRect: TRect; const ADestPos: TPoint); + procedure MaskedCopy(ASource, AMask: TFCustomCanvas; const ADestPos: TPoint); +{!!!: procedure MaskedCopyRect(ASource, AMask: TGfxCanvas; const ASourceRect: TRect; + const ADestPos: TPoint); virtual;} + procedure MaskedCopyRect(ASource, AMask: TFCustomCanvas; const ASourceRect: TRect; const AMaskPos, ADestPos: TPoint); + + // Image drawing + procedure DrawImage(AImage: TFCustomImage; const ADestPos: TPoint); + procedure DrawImageRect(AImage: TFCustomImage; ASourceRect: TRect; const ADestPos: TPoint); + + // Properties + property Width: Integer read FWidth; + property Height: Integer read FHeight; + property PixelFormat: TGfxPixelFormat read FPixelFormat; + property Matrix: TGfxMatrix read FMatrix write FMatrix; + end; + + + TFCustomImage = class(TObject) + private + FWidth, FHeight: Integer; + FPixelFormat: TGfxPixelFormat; + FPalette: TGfxPalette; + procedure SetPalette(APalette: TGfxPalette); + protected + public + constructor Create(AWidth, AHeight: Integer; APixelFormat: TGfxPixelFormat); virtual; + destructor Destroy; override; + procedure Lock(var AData: Pointer; var AStride: LongWord); virtual; abstract; + procedure Unlock; virtual; + procedure SetPixelsFromData(AData: Pointer; AStride: LongWord); + property Width: Integer read FWidth; + property Height: Integer read FHeight; + property PixelFormat: TGfxPixelFormat read FPixelFormat; + property Palette: TGfxPalette read FPalette write SetPalette; + end; + + { TFCustomScreen } + + TFCustomScreen = class(TObject) + public + constructor Create; virtual; + end; + + { TFCustomApplication } + + TFCustomApplication = class(TComponent) + private + FOnIdle: TNotifyEvent; + FQuitWhenLastWindowCloses: Boolean; + public + Forms: TList; + public + { Default methods } + constructor Create; virtual; + destructor Destroy; override; + procedure AddWindow(AWindow: TFCustomWindow); virtual; abstract; + procedure Initialize(ADisplayName: String = ''); virtual; abstract; + procedure Run; virtual; abstract; + procedure Quit; virtual; abstract; + { Properties } + property OnIdle: TNotifyEvent read FOnIdle write FOnIdle; + property QuitWhenLastWindowCloses: Boolean read FQuitWhenLastWindowCloses write FQuitWhenLastWindowCloses; + end; + + + { TFCustomWindow } + + // Lifetime handling + TGfxCanCloseEvent = function(Sender: TObject): Boolean of object; + // Keyboard + TGfxKeyEvent = procedure(Sender: TObject; AKey: Word; AShift: TShiftState) of object; + TGfxKeyCharEvent = procedure(Sender: TObject; AKeyChar: Char) of object; + // Mouse + TMouseButton = (mbLeft, mbRight, mbMiddle); + TGfxMouseButtonEvent = procedure(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint) of object; + TGfxMouseMoveEvent = procedure(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint) of object; + TGfxMouseWheelEvent = procedure(Sender: TObject; AShift: TShiftState; AWheelDelta: Single; const AMousePos: TPoint) of object; + // Painting + TGfxPaintEvent = procedure(Sender: TObject; const ARect: TRect) of object; + + + TFCustomWindow = class + private + FCursor: TGfxCursor; + FOnCreate: TNotifyEvent; + FOnCanClose: TGfxCanCloseEvent; + FOnClose: TNotifyEvent; + FOnFocusIn: TNotifyEvent; + FOnFocusOut: TNotifyEvent; + FOnHide: TNotifyEvent; + FOnKeyPressed: TGfxKeyEvent; + FOnKeyReleased: TGfxKeyEvent; + FOnKeyChar: TGfxKeyCharEvent; + FOnMouseEnter: TGfxMouseMoveEvent; + FOnMouseLeave: TNotifyEvent; + FOnMousePressed: TGfxMouseButtonEvent; + FOnMouseReleased: TGfxMouseButtonEvent; + FOnMouseMove: TGfxMouseMoveEvent; + FOnMouseWheel: TGfxMouseWheelEvent; + FOnPaint: TGfxPaintEvent; + FOnMove: TNotifyEvent; + FOnResize: TNotifyEvent; + FOnShow: TNotifyEvent; + procedure SetWidth(AWidth: Integer); + procedure SetHeight(AHeight: Integer); + procedure SetCursor(ACursor: TGfxCursor); + procedure SetWindowOptions(const AValue: TGfxWindowOptions); virtual; + protected + FHandle: Cardinal; + FCanvas: TFCustomCanvas; + FLeft: Integer; + FTop: Integer; + FWidth: Integer; + FHeight: Integer; + FClientWidth: Integer; + FClientHeight: Integer; + FWindowOptions: TGfxWindowOptions; + function GetTitle: String; virtual; + procedure SetTitle(const ATitle: String); virtual; + procedure DoSetCursor; virtual; abstract; + public + function CanClose: Boolean; virtual; + procedure SetPosition(const APosition: TPoint); virtual; + procedure SetSize(const ASize: TSize); virtual; + procedure SetMinMaxSize(const AMinSize, AMaxSize: TSize); virtual; + procedure SetFixedSize(const ASize: TSize); + procedure SetClientSize(const ASize: TSize); virtual; + procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); virtual; + procedure SetFixedClientSize(const ASize: TSize); + procedure Show; virtual; abstract; + procedure Invalidate(const ARect: TRect); virtual; abstract; + procedure PaintInvalidRegion; virtual; abstract; + procedure CaptureMouse; virtual; abstract; + procedure ReleaseMouse; virtual; abstract; + + property WindowOptions: TGfxWindowOptions read FWindowOptions write SetWindowOptions; + property Canvas: TFCustomCanvas read FCanvas; + property Handle: Cardinal read FHandle; + // Window state + property Left: Integer read FLeft; + property Top: Integer read FTop; + property Width: Integer read FWidth write SetWidth; + property Height: Integer read FHeight write SetHeight; + property ClientWidth: Integer read FClientWidth; + property ClientHeight: Integer read FClientHeight; + property Cursor: TGfxCursor read FCursor write SetCursor; + property Title: String read GetTitle write SetTitle; + // Event handlers + property OnCreate: TNotifyEvent read FOnCreate write FOnCreate; + property OnCanClose: TGfxCanCloseEvent read FOnCanClose write FOnCanClose; + property OnClose: TNotifyEvent read FOnClose write FOnClose; + property OnFocusIn: TNotifyEvent read FOnFocusIn write FOnFocusIn; + property OnFocusOut: TNotifyEvent read FOnFocusOut write FOnFocusOut; + property OnHide: TNotifyEvent read FOnHide write FOnHide; + property OnKeyPressed: TGfxKeyEvent read FOnKeyPressed write FOnKeyPressed; + property OnKeyReleased: TGfxKeyEvent read FOnKeyReleased write FOnKeyReleased; + property OnKeyChar: TGfxKeyCharEvent read FOnKeyChar write FOnKeyChar; + property OnMouseEnter: TGfxMouseMoveEvent read FOnMouseEnter write FOnMouseEnter; + property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave; + property OnMousePressed: TGfxMouseButtonEvent read FOnMousePressed write FOnMousePressed; + property OnMouseReleased: TGfxMouseButtonEvent read FOnMouseReleased write FOnMouseReleased; + property OnMouseMove: TGfxMouseMoveEvent read FOnMouseMove write FOnMouseMove; + property OnMouseWheel: TGfxMouseWheelEvent read FOnMouseWheel write FOnMouseWheel; + property OnPaint: TGfxPaintEvent read FOnPaint write FOnPaint; + property OnMove: TNotifyEvent read FOnMove write FOnMove; + property OnResize: TNotifyEvent read FOnResize write FOnResize; + property OnShow: TNotifyEvent read FOnShow write FOnShow; + end; + +// Some helpers: + +// Sizes, points etc. +function Size(AWidth, AHeight: Integer): TSize; +function Size(ARect: TRect): TSize; +function PtInRect(const ARect: TRect; const APoint: TPoint): Boolean; + +{$ifdef fpc} +operator = (const ASize1, ASize2: TSize) b: Boolean; +operator + (const APoint1, APoint2: TPoint) p: TPoint; +operator + (const APoint: TPoint; ASize: TSize) p: TPoint; +operator + (const ASize: TSize; APoint: TPoint) s: TSize; +operator + (const ASize1, ASize2: TSize) s: TSize; +operator + (const APoint: TPoint; i: Integer) p: TPoint; +operator + (const ASize: TSize; i: Integer) s: TSize; +operator - (const APoint1, APoint2: TPoint) p: TPoint; +operator - (const APoint: TPoint; i: Integer) p: TPoint; +operator - (const ASize: TSize; const APoint: TPoint) s: TSize; +operator - (const ASize: TSize; i: Integer) s: TSize; + +// Colors +operator = (const AColor1, AColor2: TGfxColor) b: Boolean; +{$endif} +function GetAvgColor(const AColor1, AColor2: TGfxColor): TGfxColor; + +// Keyboard +function KeycodeToText(Key: Word; ShiftState: TShiftState): String; + + +implementation + +uses + GFXInterface; { Just to get FPC to compile the TGfxCanvas descendants } + + +{ Exceptions } + +constructor EGfxUnsupportedPixelFormat.Create(const + APixelFormat: TGfxPixelFormat); +begin + inherited CreateFmt(SUnsupportedPixelFormat, + [FormatTypeBPPTable[APixelFormat.FormatType]]); +end; + +{ TFCustomFont } + +class function TFCustomFont.GetDefaultFontName(const AFontClass: TGfxFontClass): String; +const + FontNames: array[TGfxFontClass] of String = ( + 'times', 'helvetica', 'courier', 'dingbats'); +begin + Result := FontNames[AFontClass]; +end; + +{ TGfxPalette } + +destructor TGfxPalette.Destroy; +begin + if Assigned(FEntries) then + FreeMem(FEntries); + inherited Destroy; +end; + +procedure TGfxPalette.AddRef; +begin + Inc(FRefCount); +end; + +procedure TGfxPalette.Release; +begin + if FRefCount <= 0 then + Free + else + Dec(FRefCount); +end; + +constructor TGfxPalette.Create(AEntryCount: Integer; AEntries: PGfxColor); +begin + inherited Create; + FEntryCount := AEntryCount; + GetMem(FEntries, EntryCount * SizeOf(TGfxColor)); + if Assigned(AEntries) then + Move(AEntries^, FEntries^, EntryCount * SizeOf(TGfxColor)); +end; + +function TGfxPalette.GetEntry(AIndex: Integer): TGfxColor; +begin + if (AIndex >= 0) and (AIndex < EntryCount) then + Result := FEntries[AIndex] + else + Result := colBlack; +end; + + +{ TFCustomCanvas } + +constructor TFCustomCanvas.Create; +begin + inherited Create; + Matrix := GfxIdentityMatrix; +end; + +function TFCustomCanvas.Transform(APoint: TPoint): TPoint; +begin + Result.x := Matrix._00 * APoint.x + Matrix._20; + Result.y := Matrix._11 * APoint.y + Matrix._21; +end; + +function TFCustomCanvas.Transform(ARect: TRect): TRect; +begin + Result.Left := Matrix._00 * ARect.Left + Matrix._20; + Result.Top := Matrix._11 * ARect.Top + Matrix._21; + Result.Right := Matrix._00 * ARect.Right + Matrix._20; + Result.Bottom := Matrix._11 * ARect.Bottom + Matrix._21; +end; + +function TFCustomCanvas.ReverseTransform(APoint: TPoint): TPoint; +begin + Result.x := (APoint.x - Matrix._20) div Matrix._00; + Result.y := (APoint.y - Matrix._21) div Matrix._11; +end; + +function TFCustomCanvas.ReverseTransform(ARect: TRect): TRect; +begin + Result.Left := (ARect.Left - Matrix._20) div Matrix._00; + Result.Top := (ARect.Top - Matrix._21) div Matrix._11; + Result.Right := (ARect.Right - Matrix._20) div Matrix._00; + Result.Bottom := (ARect.Bottom - Matrix._21) div Matrix._11; +end; + +procedure TFCustomCanvas.AppendTranslation(ADelta: TPoint); +begin + // Append a translation to the existing transformation matrix + Inc(FMatrix._20, FMatrix._00 * ADelta.x); + Inc(FMatrix._21, FMatrix._11 * ADelta.y); +end; + +procedure TFCustomCanvas.EmptyClipRect; +begin + IntersectClipRect(Rect(0, 0, 0, 0)); +end; + +function TFCustomCanvas.ExcludeClipRect(const ARect: TRect): Boolean; +var + Rect: TRect; +begin + Rect := Transform(ARect); + if (Rect.Right > Rect.Left) and (Rect.Bottom > Rect.Top) then + Result := DoExcludeClipRect(Rect) + else + Result := False; +end; + +function TFCustomCanvas.IntersectClipRect(const ARect: TRect): Boolean; +var + Rect: TRect; +begin + Rect := Transform(ARect); + if (Rect.Right > Rect.Left) and (Rect.Bottom > Rect.Top) then + Result := DoIntersectClipRect(Rect) + else + Result := False; +end; + +function TFCustomCanvas.UnionClipRect(const ARect: TRect): Boolean; +var + Rect: TRect; +begin + Rect := Transform(ARect); + if (Rect.Right > Rect.Left) and (Rect.Bottom > Rect.Top) then + Result := DoUnionClipRect(Rect) + else + with GetClipRect do + Result := (Right > Left) and (Bottom > Top); +end; + +function TFCustomCanvas.GetClipRect: TRect; +begin + Result := ReverseTransform(DoGetClipRect); +end; + +procedure TFCustomCanvas.SetColor(AColor: TGfxColor); +begin + SetColor_(MapColor(AColor)); +end; + +procedure TFCustomCanvas.DrawArc(const ARect: TRect; StartAngle, EndAngle: Single); +begin + DoDrawArc(Transform(ARect), StartAngle, EndAngle); +end; + +procedure TFCustomCanvas.DrawCircle(const ARect: TRect); +begin + DoDrawCircle(Transform(ARect)); +end; + +procedure TFCustomCanvas.DrawLine(const AFrom, ATo: TPoint); +begin + DoDrawLine(Transform(AFrom), Transform(ATo)); +end; + +procedure TFCustomCanvas.DrawPolyLine(const Coords: array of TPoint); +var + i: Integer; +begin + for i := Low(Coords) to High(Coords) do + DrawLine(Coords[i], Coords[i + 1]); +end; + +procedure TFCustomCanvas.DoDrawRect(const ARect: TRect); +begin +{ DrawPolyLine( + [ARect.TopLeft, + Point(ARect.Right - 1, ARect.Top), + Point(ARect.Right - 1, ARect.Bottom - 1), + Point(ARect.Left, ARect.Bottom - 1), + ARect.TopLeft]);} + DoDrawLine(ARect.TopLeft, Point(ARect.Right - 1, ARect.Top)); + DoDrawLine(Point(ARect.Right - 1, ARect.Top), Point(ARect.Right - 1, ARect.Bottom - 1)); + DoDrawLine(Point(ARect.Right - 1, ARect.Bottom - 1), Point(ARect.Left, ARect.Bottom - 1)); + DoDrawLine(Point(ARect.Left, ARect.Bottom - 1), ARect.TopLeft); +end; + +procedure TFCustomCanvas.DrawRect(const ARect: TRect); +var + r: TRect; +begin + r := Transform(ARect); + if (r.Right > r.Left) and (r.Bottom > r.Top) then + DoDrawRect(r); +end; + +procedure TFCustomCanvas.DrawPoint(const APoint: TPoint); +begin + DoDrawPoint(Transform(APoint)); +end; + +procedure TFCustomCanvas.FillRect(const ARect: TRect); +var + r: TRect; +begin + r := Transform(ARect); + if (r.Right > r.Left) and (r.Bottom > r.Top) then + DoFillRect(r); +end; + +function TFCustomCanvas.TextExtent(const AText: String): TSize; +begin + Result.cx := TextWidth(AText); + Result.cy := FontCellHeight; +end; + +function TFCustomCanvas.TextWidth(const AText: String): Integer; +begin + Result := TextExtent(AText).cx; +end; + +procedure TFCustomCanvas.TextOut(const APosition: TPoint; const AText: String); +begin + DoTextOut(Transform(APosition), AText); +end; + +procedure TFCustomCanvas.Copy(ASource: TFCustomCanvas; const ADestPos: TPoint); +begin + ASSERT(Assigned(ASource)); + CopyRect(ASource, Rect(0, 0, ASource.Width, ASource.Height), ADestPos); +end; + +procedure TFCustomCanvas.CopyRect(ASource: TFCustomCanvas; const ASourceRect: TRect; + const ADestPos: TPoint); +var + SourceRect: TRect; +begin + SourceRect := ASource.Transform(ASourceRect); + with SourceRect do + if (Left >= Right) or (Top >= Bottom) then + exit; + + DoCopyRect(ASource, SourceRect, Transform(ADestPos)); +end; + +procedure TFCustomCanvas.MaskedCopy(ASource, AMask: TFCustomCanvas; + const ADestPos: TPoint); +begin + MaskedCopyRect(ASource, AMask, Rect(0, 0, ASource.Width, ASource.Height), + Point(0, 0), ADestPos); +end; + +procedure TFCustomCanvas.MaskedCopyRect(ASource, AMask: TFCustomCanvas; + const ASourceRect: TRect; const AMaskPos, ADestPos: TPoint); +begin + DoMaskedCopyRect(ASource, AMask, ASource.Transform(ASourceRect), + AMask.Transform(AMaskPos), Transform(ADestPos)); +end; + +procedure TFCustomCanvas.DrawImage(AImage: TFCustomImage; const ADestPos: TPoint); +begin + DrawImageRect(AImage, Rect(0, 0, AImage.Width, AImage.Height), ADestPos); +end; + +procedure TFCustomCanvas.DrawImageRect(AImage: TFCustomImage; ASourceRect: TRect; + const ADestPos: TPoint); +var + SourceRect: TRect; +begin + SourceRect := ASourceRect; +{ if SourceRect.Right > Width then + SourceRect.Right := Width; + if SourceRect.Bottom > Height then + SourceRect.Bottom := Height;} + + if (SourceRect.Right > SourceRect.Left) and + (SourceRect.Bottom > SourceRect.Top) then + DoDrawImageRect(AImage, ASourceRect, Transform(ADestPos)); +end; + +{ TFCustomImage } + +destructor TFCustomImage.Destroy; +begin + if Assigned(Palette) then + Palette.Release; + inherited Destroy; +end; + +procedure TFCustomImage.Unlock; +begin + // Default implementation: Do nothing... +end; + +procedure TFCustomImage.SetPixelsFromData(AData: Pointer; AStride: LongWord); +var + DestData: Pointer; + DestStride, BytesPerScanline: LongWord; + y: Integer; +begin + DestStride := 0; // to remove compiler warning + DestData := nil; + if Height <= 0 then + exit; + + Lock(DestData, DestStride); + try + if DestStride = AStride then + Move(AData^, DestData^, AStride * Height) + else + begin + if DestStride > AStride then + BytesPerScanline := AStride + else + BytesPerScanline := DestStride; + + y := 0; + while True do + begin + Move(AData^, DestData^, BytesPerScanline); + Inc(y); + if y = Height then + break; + Inc(AData, AStride); + Inc(DestData, DestStride); + end; + end; + finally + Unlock; + end; +end; + +constructor TFCustomImage.Create(AWidth, AHeight: Integer; + APixelFormat: TGfxPixelFormat); +begin + FWidth := AWidth; + FHeight := AHeight; + FPixelFormat := APixelFormat; +end; + +procedure TFCustomImage.SetPalette(APalette: TGfxPalette); +begin + if APalette <> Palette then + begin + if Assigned(Palette) then + Palette.Release; + + FPalette := APalette; + + if Assigned(Palette) then + Palette.AddRef; + end; +end; + +{ TFCustomScreen } + +constructor TFCustomScreen.Create; +begin + inherited Create; + +end; + +{ TFCustomWindow } + +function TFCustomWindow.CanClose: Boolean; +begin + if Assigned(OnCanClose) then + Result := OnCanClose(Self) + else + Result := True; +end; + +procedure TFCustomWindow.SetPosition(const APosition: TPoint); +begin + // Empty +end; + +procedure TFCustomWindow.SetSize(const ASize: TSize); +begin + // Empty +end; + +procedure TFCustomWindow.SetMinMaxSize(const AMinSize, AMaxSize: TSize); +begin + // Empty +end; + +procedure TFCustomWindow.SetFixedSize(const ASize: TSize); +begin + SetMinMaxSize(ASize, ASize); + SetSize(ASize); +end; + +procedure TFCustomWindow.SetClientSize(const ASize: TSize); +begin + // Empty +end; + +procedure TFCustomWindow.SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); +begin + // Empty +end; + +procedure TFCustomWindow.SetFixedClientSize(const ASize: TSize); +begin + SetMinMaxClientSize(ASize, ASize); + SetClientSize(ASize); +end; + +function TFCustomWindow.GetTitle: String; +begin + SetLength(Result, 0); +end; + +procedure TFCustomWindow.SetTitle(const ATitle: String); +begin + // Empty +end; + +procedure TFCustomWindow.SetWidth(AWidth: Integer); +begin + SetSize(Size(AWidth, Height)); +end; + +procedure TFCustomWindow.SetHeight(AHeight: Integer); +begin + SetSize(Size(Width, AHeight)); +end; + +procedure TFCustomWindow.SetCursor(ACursor: TGfxCursor); +begin + if ACursor <> Cursor then + begin + FCursor := ACursor; + DoSetCursor; + end; +end; + +procedure TFCustomWindow.SetWindowOptions(const AValue: TGfxWindowOptions); +begin + if FWindowOptions=AValue then exit; + FWindowOptions:=AValue; +end; + +// =================================================================== +// Global functions +// =================================================================== + +// Sizes, points etc. +function Size(AWidth, AHeight: Integer): TSize; +begin + Result.cx := AWidth; + Result.cy := AHeight; +end; + +function Size(ARect: TRect): TSize; +begin + Result.cx := ARect.Right - ARect.Left; + Result.cy := ARect.Bottom - ARect.Top; +end; + +function PtInRect(const ARect: TRect; const APoint: TPoint): Boolean; +begin + with ARect, APoint do + Result := (x >= Left) and (y >= Top) and (x < Right) and (y < Bottom); +end; + +{$ifdef fpc} + +operator = (const ASize1, ASize2: TSize) b: Boolean; +begin + b := (ASize1.cx = ASize2.cx) and (ASize1.cy = ASize2.cy); +end; + +operator + (const APoint1, APoint2: TPoint) p: TPoint; +begin + p.x := APoint1.x + APoint2.x; + p.y := APoint1.y + APoint2.y; +end; + +operator + (const APoint: TPoint; ASize: TSize) p: TPoint; +begin + p.x := APoint.x + ASize.cx; + p.y := APoint.y + ASize.cy; +end; + +operator + (const ASize: TSize; APoint: TPoint) s: TSize; +begin + s.cx := ASize.cx + APoint.x; + s.cy := ASize.cy + APoint.y; +end; + +operator + (const ASize1, ASize2: TSize) s: TSize; +begin + s.cx := ASize1.cx + ASize2.cx; + s.cy := ASize1.cy + ASize2.cy; +end; + +operator + (const APoint: TPoint; i: Integer) p: TPoint; +begin + p.x := APoint.x + i; + p.y := APoint.y + i; +end; + +operator + (const ASize: TSize; i: Integer) s: TSize; +begin + s.cx := ASize.cx + i; + s.cy := ASize.cy + i; +end; + +operator - (const APoint1, APoint2: TPoint) p: TPoint; +begin + p.x := APoint1.x - APoint2.x; + p.y := APoint1.y - APoint2.y; +end; + +operator - (const APoint: TPoint; i: Integer) p: TPoint; +begin + p.x := APoint.x - i; + p.y := APoint.y - i; +end; + +operator - (const ASize: TSize; const APoint: TPoint) s: TSize; +begin + s.cx := ASize.cx - APoint.x; + s.cy := ASize.cy - APoint.y; +end; + +operator - (const ASize: TSize; i: Integer) s: TSize; +begin + s.cx := ASize.cx - i; + s.cy := ASize.cy - i; +end; + + +// Color functions +operator = (const AColor1, AColor2: TGfxColor) b: Boolean; +begin + b := (AColor1.Red = AColor2.Red) and (AColor1.Green = AColor2.Green) and + (AColor1.Blue = AColor2.Blue) and (AColor1.Alpha = AColor2.Alpha); +end; +{$endif} + +function GetAvgColor(const AColor1, AColor2: TGfxColor): TGfxColor; +begin + Result.Red := AColor1.Red + (AColor2.Red - AColor1.Red) div 2; + Result.Green := AColor1.Green + (AColor2.Green - AColor1.Green) div 2; + Result.Blue := AColor1.Blue + (AColor2.Blue - AColor1.Blue) div 2; + Result.Alpha := AColor1.Alpha + (AColor2.Alpha - AColor1.Alpha) div 2; +end; + +// Keyboard functions +function KeycodeToText(Key: Word; ShiftState: TShiftState): String; + + function GetASCIIText: String; + var + c: Char; + begin + result := ''; + c := Chr(Key and $ff); + case c of + #13: Result := Result + 'Enter'; + #127: Result := Result + 'Del'; + '+': Result := Result + 'Plus' + else + Result := Result + c; + end; + end; + +var + s: String; +begin + SetLength(Result, 0); + + if ssShift in ShiftState then + Result := 'Shift+'; + if ssCtrl in ShiftState then + Result := 'Ctrl+'; + if ssAlt in ShiftState then + Result := 'Alt+'; + + if (Key > Ord(' ')) and (Key < 255) then + begin + Result := Result + GetASCIIText; + exit; + end; + + case Key of + keyNul: s := 'Null'; + keyBackSpace: s := 'Backspace'; + keyTab: s := 'Tab'; + keyLinefeed: s := 'Linefeed'; + keyReturn: s := 'Enter'; + keyEscape: s := 'Esc'; + Ord(' '): s := 'Space'; + keyDelete: s := 'Del'; + keyVoid: s := 'Void'; + keyBreak: s := 'Break'; + keyScrollForw: s := 'ScrollForw'; + keyScrollBack: s := 'ScrollBack'; + keyBoot: s := 'Boot'; + keyCompose: s := 'Compose'; + keySAK: s := 'SAK'; + keyUndo: s := 'Undo'; + keyRedo: s := 'Redo'; + keyMenu: s := 'Menu'; + keyCancel: s := 'Cancel'; + keyPrintScreen: s := 'PrtScr'; + keyExecute: s := 'Exec'; + keyFind: s := 'Find'; + keyBegin: s := 'Begin'; + keyClear: s := 'Clear'; + keyInsert: s := 'Ins'; + keySelect: s := 'Select'; + keyMacro: s := 'Macro'; + keyHelp: s := 'Help'; + keyDo: s := 'Do'; + keyPause: s := 'Pause'; + keySysRq: s := 'SysRq'; + keyModeSwitch: s := 'ModeSw'; + keyUp: s := 'Up'; + keyDown: s := 'Down'; + keyLeft: s := 'Left'; + keyRight: s := 'Right'; + keyPrior: s := 'PgUp'; + keyNext: s := 'PgDown'; + keyHome: s := 'Home'; + keyEnd: s := 'End'; + keyF0..keyF64: s := 'F' + IntToStr(Key - keyF0); + keyP0..keyP9: s := 'KP' + Chr(Key - keyP0 + Ord('0')); + keyPA..keyPF: s := 'KP' + Chr(Key - keyPA + Ord('A')); + keyPPlus, keyPMinus, keyPSlash, keyPStar, keyPEqual, keyPSeparator, + keyPDecimal, keyPParenLeft, keyPParenRight, keyPSpace, keyPEnter, + keyPTab: s := 'KP' + GetASCIIText; + keyPPlusMinus: s := 'KPPlusMinus'; + keyPBegin: s := 'KPBegin'; + keyPF1..keyPF9: s := 'KPF' + IntToStr(Key - keyPF1); + keyShiftL: s := 'ShiftL'; + keyShiftR: s := 'ShiftR'; + keyCtrlL: s := 'CtrlL'; + keyCtrlR: s := 'CtrlR'; + keyAltL: s := 'AltL'; + keyAltR: s := 'AltR'; + keyMetaL: s := 'MetaL'; + keyMetaR: s := 'MetaR'; + keySuperL: s := 'SuperL'; + keySuperR: s := 'SuperR'; + keyHyperL: s := 'HyperL'; + keyHyperR: s := 'HyperR'; + keyAltGr: s := 'AltGr'; + keyCaps: s := 'Caps'; + keyNum: s := 'Num'; + keyScroll: s := 'Scroll'; + keyShiftLock: s := 'ShiftLock'; + keyCtrlLock: s := 'CtrlLock'; + keyAltLock: s := 'AltLock'; + keyMetaLock: s := 'MetaLock'; + keySuperLock: s := 'SuperLock'; + keyHyperLock: s := 'HyperLock'; + keyAltGrLock: s := 'AltGrLock'; + keyCapsLock: s := 'CapsLock'; + keyNumLock: s := 'NumLock'; + keyScrollLock: s := 'ScrollLock'; + keyDeadRing: s := 'DeadRing'; + keyDeadCaron: s := 'DeadCaron'; + keyDeadOgonek: s := 'DeadOgonek'; + keyDeadIota: s := 'DeadIota'; + keyDeadDoubleAcute: s := 'DeadDoubleAcute'; + keyDeadBreve: s := 'DeadBreve'; + keyDeadAboveDot: s := 'DeadAboveDot'; + keyDeadBelowDot: s := 'DeadBelowDot'; + keyDeadVoicedSound: s := 'DeadVoicedSound'; + keyDeadSemiVoicedSound: s := 'DeadSemiVoicedSound'; + keyDeadAcute: s := 'DeadAcute'; + keyDeadCedilla: s := 'DeadCedilla'; + keyDeadCircumflex: s := 'DeadCircumflex'; + keyDeadDiaeresis: s := 'DeadDiaeresis'; + keyDeadGrave: s := 'DeadGrave'; + keyDeadTilde: s := 'DeadTilde'; + keyDeadMacron: s := 'DeadMacron'; + + keyEcuSign: s := 'Ecu'; + keyColonSign: s := 'Colon'; + keyCruzeiroSign: s := 'Cruzeiro'; + keyFFrancSign: s := 'FFranc'; + keyLiraSign: s := 'Lira'; + keyMillSign: s := 'Mill'; + keyNairaSign: s := 'Naira'; + keyPesetaSign: s := 'Peseta'; + keyRupeeSign: s := 'Rupee'; + keyWonSign: s := 'Won'; + keyNewSheqelSign: s := 'NewShequel'; + keyDongSign: s := 'Dong'; + keyEuroSign: s := 'Euro'; + else + s := '#' + IntToHex(Key, 4); + end; + Result := Result + s; +end; + +{ TFCustomApplication } + +constructor TFCustomApplication.Create; +begin + inherited Create(nil); + + Forms := TList.Create; + + FQuitWhenLastWindowCloses := True; +end; + +destructor TFCustomApplication.Destroy; +begin + Forms.Free; + + inherited Destroy; +end; + +end. + diff --git a/gfx/keys.inc b/gfx/keys.inc new file mode 100644 index 00000000..2d4eeb9f --- /dev/null +++ b/gfx/keys.inc @@ -0,0 +1,270 @@ +{ + fpGFX - Free Pascal Graphics Library + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGFX development team. + + fpGFX Keyboard definitions + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + +{ + We use GGI's key definitions; the names just + have been somewhat pascalified... + GGI info at <http://www.ggi-project.org> + GII info at <http://www.ggi-project.org/packages/libgii.html> +} + +const + + // ASCII keys + + keyNul = $00; + keyBackSpace = $08; + keyTab = $09; + keyLinefeed = $0a; + keyReturn = $0d; + keyEscape = $1b; + keyDelete = $7f; + + // special keys + + keyVoid = $e000; + keyBreak = $e005; + keyScrollForw = $e00a; + keyScrollBack = $e00b; + keyBoot = $e00c; + keyCompose = $e00e; + keySAK = $e00f; + keyUndo = $e017; + keyRedo = $e018; + keyMenu = $e019; + keyCancel = $e01a; + keyPrintScreen = $e01b; + keyExecute = $e01c; + keyFind = $e01e; + keyBegin = $e01f; + keyClear = $e020; + keyInsert = $e022; + keySelect = $e023; + keyMacro = $e026; + keyHelp = $e027; + keyDo = $e028; + keyPause = $e029; + keyStop = keyPause; + keySysRq = $e02a; + keyModeSwitch = $e02b; + keyUp = $e032; + keyDown = $e033; + keyLeft = $e034; + keyRight = $e035; + keyPrior = $e036; + keyPageUp = keyPrior; + keyNext = $e037; + keyPageDown = keyNext; + keyHome = $e038; + keyEnd = $e039; + + + // function keys + + keyF0 = $e100; + keyF1 = $e101; + keyF2 = $e102; + keyF3 = $e103; + keyF4 = $e104; + keyF5 = $e105; + keyF6 = $e106; + keyF7 = $e107; + keyF8 = $e108; + keyF9 = $e109; + keyF10 = $e10a; + keyF11 = $e10b; + keyF12 = $e10c; + keyF13 = $e10d; + keyF14 = $e10e; + keyF15 = $e10f; + keyF16 = $e110; + keyF17 = $e111; + keyF18 = $e112; + keyF19 = $e113; + keyF20 = $e114; + keyF21 = $e115; + keyF22 = $e116; + keyF23 = $e117; + keyF24 = $e118; + keyF25 = $e119; + keyF26 = $e11a; + keyF27 = $e11b; + keyF28 = $e11c; + keyF29 = $e11d; + keyF30 = $e11e; + keyF31 = $e11f; + keyF32 = $e120; + keyF33 = $e121; + keyF34 = $e122; + keyF35 = $e123; + keyF36 = $e124; + keyF37 = $e125; + keyF38 = $e126; + keyF39 = $e127; + keyF40 = $e128; + keyF41 = $e129; + keyF42 = $e12a; + keyF43 = $e12b; + keyF44 = $e12c; + keyF45 = $e12d; + keyF46 = $e12e; + keyF47 = $e12f; + keyF48 = $e130; + keyF49 = $e131; + keyF50 = $e132; + keyF51 = $e133; + keyF52 = $e134; + keyF53 = $e135; + keyF54 = $e136; + keyF55 = $e137; + keyF56 = $e138; + keyF57 = $e139; + keyF58 = $e13a; + keyF59 = $e13b; + keyF60 = $e13c; + keyF61 = $e13d; + keyF62 = $e13e; + keyF63 = $e13f; + keyF64 = $e140; + + + // keys on the numeric keypad + keyP0 = $e230; + keyP1 = $e231; + keyP2 = $e232; + keyP3 = $e233; + keyP4 = $e234; + keyP5 = $e235; + keyP6 = $e236; + keyP7 = $e237; + keyP8 = $e238; + keyP9 = $e239; + keyPA = $e241; + keyPB = $e242; + keyPC = $e243; + keyPD = $e244; + keyPE = $e245; + keyPF = $e246; + keyPPlus = $e200 + Ord('+'); + keyPMinus = $e200 + Ord('-'); + keyPSlash = $e200 + Ord('/'); + keyPAsterisk = $e200 + Ord('*'); + keyPStar = keyPAsterisk; + keyPEqual = $e200 + Ord('='); + keyPSeparator = $e200 + Ord(','); + keyPDecimal = $e200 + Ord('.'); + keyPParenLeft = $e200 + Ord('('); + keyPParenRight = $e200 + Ord(')'); + keyPSpace = $e200 + Ord(' '); + keyPEnter = $e20d; + keyPTab = $e208; + keyPPlusMinus = $e280; + keyPBegin = $e281; + keyPF1 = $e291; + keyPF2 = $e292; + keyPF3 = $e293; + keyPF4 = $e294; + keyPF5 = $e295; + keyPF6 = $e296; + keyPF7 = $e297; + keyPF8 = $e298; + keyPF9 = $e299; + + + // modifier keys + + keyShift = $e300; + keyCtrl = $e301; + keyAlt = $e302; + keyMeta = $e303; + keySuper = $e304; + keyHyper = $e305; + keyAltGr = $e306; + keyCaps = $e307; + keyNum = $e308; + keyScroll = $e309; + + + // modifier _labels_ + + keyShiftL = $e300; + keyShiftR = $e340; + keyCtrlL = $e301; + keyCtrlR = $e341; + keyAltL = $e302; + keyAltR = $e342; + keyMetaL = $e303; + keyMetaR = $e343; + keySuperL = $e304; + keySuperR = $e344; + keyHyperL = $e305; + keyHyperR = $e345; + keyShiftLock = $e380; + keyCtrlLock = $e381; + keyAltLock = $e382; + keyMetaLock = $e383; + keySuperLock = $e384; + keyHyperLock = $e385; + keyAltGrLock = $e386; + keyCapsLock = $e387; + keyNumLock = $e388; + keyScrollLock = $e389; + + // Dead keys + keyDeadRing = $e400; + keyDeadCaron = $e401; + keyDeadOgonek = $e402; + keyDeadIota = $e403; + keyDeadDoubleAcute = $e404; + keyDeadBreve = $e405; + keyDeadAboveDot = $e406; + keyDeadBelowDot = $e407; + keyDeadVoicedSound = $e408; + keyDeadSemiVoicedSound = $e409; + + + keyDeadAcute = $e4b4; + keyDeadCedilla = $e4b8; + keyDeadCircumflex = $e45e; + keyDeadDiaeresis = $e4a8; + keyDeadGrave = $e460; + keyDeadTilde = $e47e; + keyDeadMacron = $e4af; + + // miscellaneous + keyNIL = $ffff; // used to indicate "not mapped yet" + + + // currencies (NOTE: These values are not defined in GGI/GII! + // !!!: Check if GII has got currency codes in the meantime + keyEcuSign = $e500; + keyColonSign = $e501; + keyCruzeiroSign = $e502; + keyFFrancSign = $e503; + keyLiraSign = $e504; + keyMillSign = $e505; + keyNairaSign = $e506; + keyPesetaSign = $e507; + keyRupeeSign = $e508; + keyWonSign = $e509; + keyNewSheqelSign = $e50a; + keyDongSign = $e50b; + keyEuroSign = $e50c; + + + diff --git a/gfx/schar16.pas b/gfx/schar16.pas new file mode 100644 index 00000000..156004ba --- /dev/null +++ b/gfx/schar16.pas @@ -0,0 +1,339 @@ +{ schar16.pas: Function for handling 16 bit unicode in normal 8 bit ansi strings + File maintainer: nvitya@freemail.hu + +History: +} + +unit schar16; + +{$ifdef FPC} +{$mode objfpc}{$H+} +{$endif} + +interface + +uses + Classes, SysUtils; + +const + u8escchar : char = '^'; + u8escclose : char = ';'; + +type + String16 = string; + String8 = string; + + Char16 = packed record + char1 : char; + char2 : char; + end; + +function Str8to16(s : String8) : string16; // = u8 +function Str16to8(s : String16) : string8; // = u16u8 + +function u8(s : String8) : string16; // decodes escaped text +function u8u16(s : String8) : string16; // same as u8 +function u8noesc(s : String8) : string16; // inserts #0-s, doesn't use escapes + +function u16u8(s : string16) : string8; // escapes only 256..65535 +function u16u8safe(s : string16) : string8; // escapes 0.31 and 255..65535 +function u16u8trunc(s : string16) : string8; // truncates hi byte, doesn't use escapes ('^' -> '^'), try handle code pages +// this function could cause information loss + +function Length16(s : String16) : integer; +procedure SetLength16(var s : String16; len : integer); + +function Pos16(const s : string16; const searched : string16) : integer; +function UpCase16(const s : string16) : string16; +function Upper16(const s : string16) : string16; + +function Copy16(s : String16; ind,len : integer) : String16; +procedure Insert16(s : String16; var dest : string16; ind : integer); +procedure Delete16(var s : String16; ind, count : integer); + +procedure AddChar16(var s : String16; ch16 : Char16); overload; +procedure AddChar16(var s : String16; w : word); overload; + +implementation + +uses UnitKeys; + +function u8(s : String8) : string16; +var + n : integer; + ccode : word; + c : char; +begin + // 'asdf^123^452^354;78; + result := ''; + n := 1; + while (n <= length(s)) do + begin + if s[n] = u8escchar then + begin + inc(n); + if (n <= length(s)) and (s[n] = u8escchar) then + begin + result := result + u8escchar + #0; + inc(n); + continue; + end; + + ccode := 0; + while (n <= length(s)) do + begin + c := s[n]; + if (c >= '0') and (c <= '9') then ccode := ccode * 10 + (ord(c)-ord('0')) + else + break; + inc(n); + end; + result := result + chr(lo(ccode)) + chr(hi(ccode)); + + if (n <= length(s)) and (s[n] = u8escclose) then inc(n); + end + else + begin + result := result + s[n] + #0; + inc(n); + end; + end; +end; + +function u8u16(s : String8) : string16; // same as u8 +begin + result := u8(s); +end; + +function u16u8safe(s : string16) : string8; +var + ccode : word; + n : integer; + uni : boolean; +begin + result := ''; + uni := false; + n := 1; + while n < length(s) do + begin + ccode := ord(s[n]) + (ord(s[n+1]) shl 8); + if (ccode < 32) or (ccode > 254) then + begin + result := result + u8escchar + IntToStr(ccode); + uni := true; + end + else + begin + if ccode = ord(u8escchar) then result := result + u8escchar + u8escchar + else + begin + if uni and (ccode >= ord('0')) and (ccode <= ord('9')) then result := result + u8escclose; + result := result + chr(ccode); + end; + uni := false; + end; + inc(n,2); + end; +end; + +function u16u8(s : string16) : string8; +var + ccode : word; + n : integer; + uni : boolean; +begin + result := ''; + uni := false; + n := 1; + while n < length(s) do + begin + ccode := ord(s[n]) + (ord(s[n+1]) shl 8); + if (ccode > 255) then + begin + result := result + u8escchar + IntToStr(ccode); + uni := true; + end + else + begin + if ccode = ord(u8escchar) then result := result + u8escchar + u8escchar + else + begin + if uni and (ccode >= ord('0')) and (ccode <= ord('9')) then result := result + u8escclose; + result := result + chr(ccode); + end; + uni := false; + end; + inc(n,2); + end; +end; + +function u16u8trunc(s : string16) : string8; +var + n : integer; + i : integer; + len : integer; + ct,c : char; +begin + SetLength(Result,length16(s)); + i := 1; + len := length16(s); + for n := 1 to len do + begin + ct := s[i+1]; + c := s[i]; + // some hungarian translation: + if ct = #1 then + begin + c := TranslateChar(ct,c); + end; + Result[n] := c; + inc(i,2); + end; +end; + +function u8noesc(s: String8): string16; +var + n : integer; + i : integer; + len : integer; +begin + SetLength16(Result,length(s)); + i := 1; + len := length(s); + for n := 1 to len do + begin + Result[i] := s[n]; + inc(i); + Result[i] := #0; + inc(i); + end; +end; + +function Str8to16(s : String8) : string16; +begin + result := u8(s); +end; + +function Str16to8(s : String16) : string8; +begin + result := u16u8(s); +end; + +{ +function Str8to16(s : String8) : string16; +var + n : integer; + i : integer; + len : integer; +begin + SetLength16(Result,length(s)); + i := 1; + len := length(s); + for n := 1 to len do + begin + Result[i] := s[n]; + inc(i); + Result[i] := #0; + inc(i); + end; +end; + +function Str16to8(s : String8) : string8; +var + n : integer; + i : integer; + len : integer; + ct,c : char; +begin + SetLength(Result,length16(s)); + i := 1; + len := length16(s); + for n := 1 to len do + begin + ct := s[i+1]; + c := s[i]; + // some hungarian translation: + if ct = #1 then + begin + c := TranslateChar(ct,c); + end; + Result[n] := c; + inc(i,2); + end; +end; +} + +procedure SetLength16(var s : String16; len : integer); +begin + if len >= 0 then SetLength(s,len shl 1); +end; + +function Length16(s : String16) : integer; +begin + Result := Length(s) shr 1; +end; + +function Pos16(const s : string16; const searched : string16) : integer; +var + n: integer; +begin + result := 0; + if length16(s) < 1 then Exit; + for n := 1 to Length16(searched)-Length16(s) do + begin + if CompareMem(@s[1], @searched[n*2-1], Length16(s)) then + begin + result := n; + Exit; + end; + end; +end; + +function UpCase16(const s : string16) : string16; +begin + if length(s) < 2 then Exit; + if s[2] = #0 then Result := UpCase(s[1])+#0 + else + begin + result := chr(ord(s[1]) and $FE) + s[2]; + end; +end; + +function Upper16(const s : string16) : string16; +var + n : integer; +begin + result := ''; + for n := 1 to length16(s) do + begin + result := result + UpCase16(s[n*2-1]+s[n*2]); + end; +end; + +function Copy16(s : String16; ind,len : integer) : String16; +begin + result := copy(s,1 + ((ind-1) shl 1), len shl 1); +end; + +procedure Insert16(s : String16; var dest : string16; ind : integer); +begin + Insert(s,dest,1 + ((ind-1) shl 1)); +end; + +procedure Delete16(var s : String16; ind, count : integer); +begin + Delete(s,1 + ((ind-1) shl 1), count shl 1); +end; + +procedure AddChar16(var s : String16; ch16 : Char16); +begin + s := s + ch16.char1 + ch16.char2; +end; + +procedure AddChar16(var s : String16; w : word); +begin + s := s + chr(lo(w)) + chr(hi(w)); +end; + +end. + diff --git a/gfx/template/Makefile b/gfx/template/Makefile new file mode 100644 index 00000000..a89c9e5c --- /dev/null +++ b/gfx/template/Makefile @@ -0,0 +1,1249 @@ +# +# Makefile generated by fpcmake v1.00 [2000/12/14] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION FPCOPT + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Default FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR=../../../.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override UNITOBJECTS+=gfx_xxx +override RSTOBJECTS+=gfx_xxx + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2h + +# Directories + +override NEEDUNITDIR=.. + +# Packages + +override PACKAGES+=rtl + +# Libraries + +LIBNAME=fpgfx_xxx + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +ifdef inUnix +PPAS=ppas.sh +else +ifdef inOS2 +PPAS=ppas.cmd +else +PPAS=ppas.bat +endif +endif + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Units +##################################################################### + +.PHONY: fpc_units + +override ALLTARGET+=fpc_units + +override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS)) +override INSTALLPPUFILES+=$(UNITPPUFILES) +override CLEANPPUFILES+=$(UNITPPUFILES) + +fpc_units: $(UNITPPUFILES) + +##################################################################### +# Resource strings +##################################################################### + +ifdef RSTOBJECTS +override RSTFILES=$(addsuffix $(RSTEXT),$(RSTOBJECTS)) + +override CLEANRSTFILES+=$(RSTFILES) +endif + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) +ifdef USETAR + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) + cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR) +else + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) + cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/gfx/template/Makefile.fpc b/gfx/template/Makefile.fpc new file mode 100644 index 00000000..85bbc17e --- /dev/null +++ b/gfx/template/Makefile.fpc @@ -0,0 +1,22 @@ +# +# Makefile.fpc for fpGFX target template +# + +[targets] +units=gfx_xxx +# do not compile gfximpl for this dummy target +rst=gfx_xxx + +[require] +options=-S2h +packages= + +[libs] +libname=fpgfx_xxx + +[install] +subdir= + +[dirs] +fpcdir=../../../.. +unitdir=.. diff --git a/gfx/template/gfx_xxx.pas b/gfx/template/gfx_xxx.pas new file mode 100644 index 00000000..904c929b --- /dev/null +++ b/gfx/template/gfx_xxx.pas @@ -0,0 +1,435 @@ +{ + fpGFX - Free Pascal Graphics Library + Copyright (C) 2000 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGFX development team. + + Template for new target implementations + + See the file COPYING.fpGFX, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +unit GFX_xxx; + +interface + +uses + SysUtils, Classes, // FPC units + // xxx (insert target dependent units here) + GfxBase; // fpGUI units + +type + + ExxxError = class(EGfxError); + + TxxxDrawable = class; + TxxxDisplay = class; + + TxxxFont = class(TGfxFont) + public + constructor Create; + destructor Destroy; override; + end; + + PxxxDrawableState = ^TxxxDrawableState; + TxxxDrawableState = record + Prev: PxxxDrawableState; + Matrix: TGfxMatrix; + // xxx Region data etc. + end; + + TxxxDrawable = class(TGfxDrawable) + private + FDisplay: TxxxDisplay; + FStateStackpointer: PxxxDrawableState; + procedure Resized(NewWidth, NewHeight: Integer); + public + constructor Create(ADisplay: TxxxDisplay); // xxx And other arguments optionally + destructor Destroy; override; + + function CreateMemoryDrawable(AWidth, AHeight: Cardinal; + const APixelFormat: TGfxPixelFormat; + AStride: LongWord; AData: Pointer): TGfxDrawable; override; + + procedure SaveState; override; + procedure RestoreState; override; + function ExcludeClipRect(const ARect: TRect): Boolean; override; + function IntersectClipRect(const ARect: TRect): Boolean; override; + function GetClipRect: TRect; override; + function MapColor(const AColor: TGfxColor): TGfxPixel; override; + procedure SetColor(AColor: TGfxPixel); override; + procedure SetFont(AFont: TGfxFont); override; + procedure SetLineStyle(ALineStyle: TGfxLineStyle); override; + + procedure DrawArc(const Rect: TRect; StartAngle, EndAngle: Single); override; + procedure DrawCircle(const Rect: TRect); override; + procedure DrawLine(x1, y1, x2, y2: Integer); override; + procedure FillRect(const Rect: TRect); override; + function FontCellHeight: Integer; override; + function TextWidth(const AText: String): Cardinal; override; + procedure TextOut(x, y: Integer; const AText: String); override; + + procedure CopyRect(ASource: TGfxDrawable; const ASourceRect: TRect; + ADestX, ADestY: Integer); override; + + + property Display: TxxxDisplay read FDisplay; + end; + + + TxxxWindow = class; + + TxxxDisplay = class(TGfxDisplay) + public + destructor Destroy; override; + function CreateFont(const Descriptor: String): TGfxFont; override; + function CreateWindow: TGfxWindow; override; + procedure Run; override; + end; + + + xxxSomeHandleType = Pointer; // !!!: Remove this in your implementation + + TxxxWindow = class(TGfxWindow) + private + FHandle: xxxSomeHandleType; + protected + function GetTitle: String; override; + procedure SetTitle(const ATitle: String); override; + private + constructor Create(ADisplay: TxxxDisplay); + public + destructor Destroy; override; + + procedure SetSize(AWidth, AHeight: Cardinal); override; + procedure SetMinMaxSize(AMinWidth, AMinHeight, + AMaxWidth, AMaxHeight: Cardinal); override; + procedure Show; override; + procedure Invalidate(const ARect: TRect); override; + procedure CaptureMouse; override; + procedure ReleaseMouse; override; + + property Handle: xxxSomeHandleType read FHandle; + end; + + +// =================================================================== +// =================================================================== + +implementation + + +// ------------------------------------------------------------------- +// TxxxFont +// ------------------------------------------------------------------- + +constructor TxxxFont.Create; +begin + inherited Create; + // !!!: Implement this +end; + +destructor TxxxFont.Destroy; +begin + // !!!: Implement this + inherited Destroy; +end; + + +// ------------------------------------------------------------------- +// TxxxDrawable +// ------------------------------------------------------------------- + + + +// ------------------------------------------------------------------- +// TxxxDrawable +// ------------------------------------------------------------------- + +constructor TxxxDrawable.Create(ADisplay: TxxxDisplay); +begin + inherited Create; + FDisplay := ADisplay; + // !!!: Create handle, init graphics state (line attributes, font etc.) +end; + +destructor TxxxDrawable.Destroy; +begin + // !!!: Implement this + inherited Destroy; +end; + +function TxxxDrawable.CreateMemoryDrawable(AWidth, AHeight: Cardinal; + const APixelFormat: TGfxPixelFormat; + AStride: LongWord; AData: Pointer): TGfxDrawable; +begin + // !!!: Implement this + raise EGfxError.Create(SUnsupportedPixelFormat); + Result := nil; +end; + +procedure TxxxDrawable.SaveState; +var + SavedState: PxxxDrawableState; +begin + New(SavedState); + SavedState^.Prev := FStateStackpointer; + SavedState^.Matrix := Matrix; + // !!!: Save additional state informations + FStateStackpointer := SavedState; +end; + +procedure TxxxDrawable.RestoreState; +var + SavedState: PxxxDrawableState; +begin + SavedState := FStateStackpointer; + FStateStackpointer := SavedState^.Prev; + Matrix := SavedState^.Matrix; + // !!!: Restore additional state informations + Dispose(SavedState); +end; + +function TxxxDrawable.ExcludeClipRect(const ARect: TRect): Boolean; +var + x1, y1, x2, y2: Integer; +begin + Transform(ARect.Left, ARect.Top, x1, y1); + Transform(ARect.Right, ARect.Bottom, x2, y2); + + if (x2 > x1) and (y2 > y1) then + begin + // !!!: Implement this + Result := True; // !!!: Return False if region is empty + end else + Result := False; +end; + +function TxxxDrawable.IntersectClipRect(const ARect: TRect): Boolean; +var + x1, y1, x2, y2: Integer; +begin + Transform(ARect.Left, ARect.Top, x1, y1); + Transform(ARect.Right, ARect.Bottom, x2, y2); + + if (x2 > x1) and (y2 > y1) then + begin + // !!!: Implement this + Result := True; // !!!: Return False if region is empty + end else + Result := False; +end; + +function TxxxDrawable.GetClipRect: TRect; +begin + // !!!: Implement this + Result.Left := 0; + Result.Top := 0; + Result.Right := 0; + Result.Bottom := 0; +end; + +function TxxxDrawable.MapColor(const AColor: TGfxColor): TGfxPixel; +begin + // !!!: Implement this + Result := 0; +end; + +procedure TxxxDrawable.SetColor(AColor: TGfxPixel); +begin + // !!!: Implement this +end; + +procedure TxxxDrawable.SetFont(AFont: TGfxFont); +begin + // !!!: Implement this +end; + +procedure TxxxDrawable.SetLineStyle(ALineStyle: TGfxLineStyle); +begin + // !!!: Implement this +end; + +procedure TxxxDrawable.DrawArc(const Rect: TRect; StartAngle, EndAngle: Single); +var + x1, y1, x2, y2: Integer; +begin + Transform(Rect.Left, Rect.Top, x1, y1); + Transform(Rect.Right, Rect.Bottom, x2, y2); + // !!!: Implement this +end; + +procedure TxxxDrawable.DrawCircle(const Rect: TRect); +var + x1, y1, x2, y2: Integer; +begin + Transform(Rect.Left, Rect.Top, x1, y1); + Transform(Rect.Right, Rect.Bottom, x2, y2); + // !!!: Implement this +end; + +procedure TxxxDrawable.DrawLine(x1, y1, x2, y2: Integer); +begin + Transform(x1, y1, x1, y1); + Transform(x2, y2, x2, y2); + // !!!: Implement this +end; + +procedure TxxxDrawable.FillRect(const Rect: TRect); +var + r: TRect; +begin + Transform(Rect.Left, Rect.Top, r.Left, r.Top); + Transform(Rect.Right, Rect.Bottom, r.Right, r.Bottom); + // !!!: Implement this +end; + +function TxxxDrawable.FontCellHeight: Integer; +begin + // !!!: Implement this + Result := 16; +end; + +function TxxxDrawable.TextWidth(const AText: String): Cardinal; +begin + // !!!: Implement this + Result := 16 * Length(AText); +end; + +procedure TxxxDrawable.TextOut(x, y: Integer; const AText: String); +begin + Transform(x, y, x, y); + // !!!: Implement this +end; + +procedure TxxxDrawable.CopyRect(ASource: TGfxDrawable; const ASourceRect: TRect; + DestX, DestY: Integer); +begin + Transform(DestX, DestY, DestX, DestY); + // !!!: Implement this +end; + +procedure TxxxDrawable.Resized(NewWidth, NewHeight: Integer); +begin + FWidth := NewWidth; + FHeight := NewHeight; +end; + + +// ------------------------------------------------------------------- +// TxxxDisplay +// ------------------------------------------------------------------- + +destructor TxxxDisplay.Destroy; +begin + // !!!: Implement this + inherited Destroy; +end; + +function TxxxDisplay.CreateFont(const Descriptor: String): TGfxFont; +begin + Result := TxxxFont.Create; +end; + +function TxxxDisplay.CreateWindow: TGfxWindow; +begin + Result := TxxxWindow.Create(Self); + // !!!: Implement this +end; + +procedure TxxxDisplay.Run; +begin + // !!!: Implement this +end; + + +// ------------------------------------------------------------------- +// TxxxWindow +// ------------------------------------------------------------------- + +function TxxxWindow.GetTitle: String; +begin + // !!!: Implement this + Result := inherited; +end; + +procedure TxxxWindow.SetTitle(const ATitle: String); +begin + // !!!: Implement this +end; + +constructor TxxxWindow.Create(ADisplay: TxxxDisplay); +begin + inherited Create; + FDisplay := ADisplay; + // !!!: Implement this + FDrawable := TxxxDrawable.Create(ADisplay); // !!!: Create a suitable drawable +end; + +destructor TxxxWindow.Destroy; +begin + if Assigned(OnClose) then + OnClose(Self); + + Drawable.Free; + + // !!!: Clean up + + inherited Destroy; +end; + +procedure TxxxWindow.SetSize(AWidth, AHeight: Cardinal); +begin + // !!!: Implement this +end; + +procedure TxxxWindow.SetMinMaxSize(AMinWidth, AMinHeight, + AMaxWidth, AMaxHeight: Cardinal); +begin + // !!!: Implement this +end; + +procedure TxxxWindow.Show; +begin + // !!!: Implement this +end; + +procedure TxxxWindow.Invalidate(const ARect: TRect); +begin + // !!!: Implement this +end; + +procedure TxxxWindow.CaptureMouse; +begin + // !!!: Implement this +end; + +procedure TxxxWindow.ReleaseMouse; +begin + // !!!: Implement this +end; + + +end. + + +{ + $Log: gfx_xxx.pp,v $ + Revision 1.3 2000/12/23 23:07:24 sg + *** empty log message *** + + Revision 1.2 2000/10/28 20:28:27 sg + * First version + + Revision 1.1 2000/08/04 21:05:53 sg + * First version in CVS + +} diff --git a/gfx/template/gfxinterface.pas b/gfx/template/gfxinterface.pas new file mode 100644 index 00000000..189b772c --- /dev/null +++ b/gfx/template/gfxinterface.pas @@ -0,0 +1,46 @@ +{ + fpGFX - Free Pascal Graphics Library + Copyright (C) 2000 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGFX development team. + + Default target selection unit for template unit + + See the file COPYING.fpGFX, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +unit GFXImpl; + +interface + +uses GFX_xxx; + + +type + + TDefDisplay = TxxxDisplay; + TDefWindow = TxxxWindow; + + +implementation + +end. + + +{ + $Log: gfximpl.pp,v $ + Revision 1.2 2000/10/28 20:28:27 sg + * First version + + Revision 1.1 2000/08/04 21:05:53 sg + * First version in CVS + +} diff --git a/gfx/unitkeys.pas b/gfx/unitkeys.pas new file mode 100644 index 00000000..439f7c38 --- /dev/null +++ b/gfx/unitkeys.pas @@ -0,0 +1,347 @@ +{ unitkeys.pas: some unicode translations + File maintainer: nvitya@freemail.hu + +History: +} + +unit unitkeys; + +{$ifdef FPC} + {$mode objfpc}{$H+} +{$endif} + +interface + +uses + Classes, SysUtils; + +function TranslateChar(page, ch : char) : char; + +// This conversion was taken from the OppenOffice 1.0.1 source code. +procedure KeySymToUnicode(ks : longword; res : PWord); + +implementation + +type + unichar = word; + +function TranslateChar(page, ch : char) : char; +begin + result := ch; + // some simple hungarian translation> + if ord(page) = 1 then + begin + case ord(ch) of + $50 : result := chr($D5); + $51 : result := chr($F5); + + $70 : result := chr($DB); + $71 : result := chr($FB); + end; + //writeln(ord(ch),' -> ',result); + end; +end; + +const + +// Latin-1 Byte 3 = $00 + keymap00 : array[32..255] of unichar = ( + $0020, $0021, $0022, $0023, $0024, $0025, $0026, $0027, + $0028, $0029, $002a, $002b, $002c, $002d, $002e, $002f, + $0030, $0031, $0032, $0033, $0034, $0035, $0036, $0037, + $0038, $0039, $003a, $003b, $003c, $003d, $003e, $003f, + $0040, $0041, $0042, $0043, $0044, $0045, $0046, $0047, + $0048, $0049, $004a, $004b, $004c, $004d, $004e, $004f, + $0050, $0051, $0052, $0053, $0054, $0055, $0056, $0057, + $0058, $0059, $005a, $005b, $005c, $005d, $005e, $005f, + $0060, $0061, $0062, $0063, $0064, $0065, $0066, $0067, + $0068, $0069, $006a, $006b, $006c, $006d, $006e, $006f, + $0070, $0071, $0072, $0073, $0074, $0075, $0076, $0077, + $0078, $0079, $007a, $007b, $007c, $007d, $007e, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $00a0, $00a1, $00a2, $00a3, $00a4, $00a5, $00a6, $00a7, + $00a8, $00a9, $00aa, $00ab, $00ac, $00ad, $00ae, $00af, + $00b0, $00b1, $00b2, $00b3, $00b4, $00b5, $00b6, $00b7, + $00b8, $00b9, $00ba, $00bb, $00bc, $00bd, $00be, $00bf, + $00c0, $00c1, $00c2, $00c3, $00c4, $00c5, $00c6, $00c7, + $00c8, $00c9, $00ca, $00cb, $00cc, $00cd, $00ce, $00cf, + $00d0, $00d1, $00d2, $00d3, $00d4, $00d5, $00d6, $00d7, + $00d8, $00d9, $00da, $00db, $00dc, $00dd, $00de, $00df, + $00e0, $00e1, $00e2, $00e3, $00e4, $00e5, $00e6, $00e7, + $00e8, $00e9, $00ea, $00eb, $00ec, $00ed, $00ee, $00ef, + $00f0, $00f1, $00f2, $00f3, $00f4, $00f5, $00f6, $00f7, + $00f8, $00f9, $00fa, $00fb, $00fc, $00fd, $00fe, $00ff + ); + +// Latin-2 Byte 3 = $01 + keymap01 : array[161..255] of unichar = ( + $0104, $02d8, $0141, $0000, $013d, $015a, $0000, $0000, + $0160, $015e, $0164, $0179, $0000, $017d, $017b, $0000, + $0105, $02db, $0142, $0000, $013e, $015b, $02c7, $0000, + $0161, $015f, $0165, $017a, $02dd, $017e, $017c, $0154, + $0000, $0000, $0102, $0000, $0139, $0106, $0000, $010c, + $0000, $0118, $0000, $011a, $0000, $0000, $010e, $0110, + $0143, $0147, $0000, $0000, $0150, $0000, $0000, $0158, + $016e, $0000, $0170, $0000, $0000, $0162, $0000, $0155, + $0000, $0000, $0103, $0000, $013a, $0107, $0000, $010d, + $0000, $0119, $0000, $011b, $0000, $0000, $010f, $0111, + $0144, $0148, $0000, $0000, $0151, $0000, $0000, $0159, + $016f, $0000, $0171, $0000, $0000, $0163, $02d9 ); + +// Latin-3 Byte 3 = $02 + keymap02 : array[161..254] of unichar = ( + $0126, $0000, $0000, $0000, $0000, $0124, $0000, $0000, + $0130, $0000, $011e, $0134, $0000, $0000, $0000, $0000, + $0127, $0000, $0000, $0000, $0000, $0125, $0000, $0000, + $0131, $0000, $011f, $0135, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $010a, $0108, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0120, $0000, $0000, $011c, + $0000, $0000, $0000, $0000, $016c, $015c, $0000, $0000, + $0000, $0000, $0000, $0000, $010b, $0109, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0121, $0000, $0000, $011d, + $0000, $0000, $0000, $0000, $016d, $015d ); + +// Latin-4 Byte 3 = $03 + keymap03 : array[162..254] of unichar = ( + $0138, $0156, $0000, $0128, $013b, $0000, $0000, $0000, + $0112, $0122, $0166, $0000, $0000, $0000, $0000, $0000, + $0000, $0157, $0000, $0129, $013c, $0000, $0000, $0000, + $0113, $0123, $0167, $014a, $0000, $014b, $0100, $0000, + $0000, $0000, $0000, $0000, $0000, $012e, $0000, $0000, + $0000, $0000, $0116, $0000, $0000, $012a, $0000, $0145, + $014c, $0136, $0000, $0000, $0000, $0000, $0000, $0172, + $0000, $0000, $0000, $0168, $016a, $0000, $0101, $0000, + $0000, $0000, $0000, $0000, $0000, $012f, $0000, $0000, + $0000, $0000, $0117, $0000, $0000, $012b, $0000, $0146, + $014d, $0137, $0000, $0000, $0000, $0000, $0000, $0173, + $0000, $0000, $0000, $0169, $016b ); + +// Kana Byte 3 = $04 + keymap04 : array[126..223] of unichar = ( + $203e, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $3002, $300c, $300d, $3001, $30fb, + $30f2, $30a1, $30a3, $30a5, $30a7, $30a9, $30e3, $30e5, + $30e7, $30c3, $30fc, $30a2, $30a4, $30a6, $30a8, $30aa, + $30ab, $30ad, $30af, $30b1, $30b3, $30b5, $30b7, $30b9, + $30bb, $30bd, $30bf, $30c1, $30c4, $30c6, $30c8, $30ca, + $30cb, $30cc, $30cd, $30ce, $30cf, $30d2, $30d5, $30d8, + $30db, $30de, $30df, $30e0, $30e1, $30e2, $30e4, $30e6, + $30e8, $30e9, $30ea, $30eb, $30ec, $30ed, $30ef, $30f3, + $309b, $309c ); + +// Arabic Byte 3 = $05 + keymap05 : array[172..242] of unichar = ( + $060c, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $061b, + $0000, $0000, $0000, $061f, $0000, $0621, $0622, $0623, + $0624, $0625, $0626, $0627, $0628, $0629, $062a, $062b, + $062c, $062d, $062e, $062f, $0630, $0631, $0632, $0633, + $0634, $0635, $0636, $0637, $0638, $0639, $063a, $0000, + $0000, $0000, $0000, $0000, $0640, $0641, $0642, $0643, + $0644, $0645, $0646, $0647, $0648, $0649, $064a, $064b, + $064c, $064d, $064e, $064f, $0650, $0651, $0652 ); + +// Cyrillic Byte 3 = $06 + keymap06 : array[161..255] of unichar = ( + $0452, $0453, $0451, $0454, $0455, $0456, $0457, $0458, + $0459, $045a, $045b, $045c, $0000, $045e, $045f, $2116, + $0402, $0403, $0401, $0404, $0405, $0406, $0407, $0408, + $0409, $040a, $040b, $040c, $0000, $040e, $040f, $044e, + $0430, $0431, $0446, $0434, $0435, $0444, $0433, $0445, + $0438, $0439, $043a, $043b, $043c, $043d, $043e, $043f, + $044f, $0440, $0441, $0442, $0443, $0436, $0432, $044c, + $044b, $0437, $0448, $044d, $0449, $0447, $044a, $042e, + $0410, $0411, $0426, $0414, $0415, $0424, $0413, $0425, + $0418, $0419, $041a, $041b, $041c, $041d, $041e, $041f, + $042f, $0420, $0421, $0422, $0423, $0416, $0412, $042c, + $042b, $0417, $0428, $042d, $0429, $0427, $042a ); + +// Greek Byte 3 = $07 + keymap07 : array[161..249] of unichar = ( + $0386, $0388, $0389, $038a, $03aa, $0000, $038c, $038e, + $03ab, $0000, $038f, $0000, $0000, $0385, $2015, $0000, + $03ac, $03ad, $03ae, $03af, $03ca, $0390, $03cc, $03cd, + $03cb, $03b0, $03ce, $0000, $0000, $0000, $0000, $0000, + $0391, $0392, $0393, $0394, $0395, $0396, $0397, $0398, + $0399, $039a, $039b, $039c, $039d, $039e, $039f, $03a0, + $03a1, $03a3, $0000, $03a4, $03a5, $03a6, $03a7, $03a8, + $03a9, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $03b1, $03b2, $03b3, $03b4, $03b5, $03b6, $03b7, $03b8, + $03b9, $03ba, $03bb, $03bc, $03bd, $03be, $03bf, $03c0, + $03c1, $03c3, $03c2, $03c4, $03c5, $03c6, $03c7, $03c8, + $03c9 ); + +// Technical Byte 3 = $08 + keymap08 : array[161..254] of unichar = ( + $23b7, $250c, $2500, $2320, $2321, $2502, $23a1, $23a3, + $23a4, $23a6, $239b, $239d, $239e, $23a0, $23a8, $23ac, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $2264, $2260, $2265, $222b, $2234, + $221d, $221e, $0000, $0000, $2207, $0000, $0000, $223c, + $2243, $0000, $0000, $0000, $21d4, $21d2, $2261, $0000, + $0000, $0000, $0000, $0000, $0000, $221a, $0000, $0000, + $0000, $2282, $2283, $2229, $222a, $2227, $2228, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $2202, $0000, + $0000, $0000, $0000, $0000, $0000, $0192, $0000, $0000, + $0000, $0000, $2190, $2191, $2192, $2193 ); + +// Special Byte 3 = $09 + keymap09 : array[224..248] of unichar = ( + $25c6, $2592, $2409, $240c, $240d, $240a, $0000, $0000, + $2424, $240b, $2518, $2510, $250c, $2514, $253c, $23ba, + $23bb, $2500, $23bc, $23bd, $251c, $2524, $2534, $252c, + $2502 ); + +// Publishing Byte 3 = $0a = 10 + keymap10 : array[161..254] of unichar = ( + $2003, $2002, $2004, $2005, $2007, $2008, $2009, $200a, + $2014, $2013, $0000, $0000, $0000, $2026, $2025, $2153, + $2154, $2155, $2156, $2157, $2158, $2159, $215a, $2105, + $0000, $0000, $2012, $2329, $0000, $232a, $0000, $0000, + $0000, $0000, $215b, $215c, $215d, $215e, $0000, $0000, + $2122, $2613, $0000, $25c1, $25b7, $25cb, $25af, $2018, + $2019, $201c, $201d, $211e, $0000, $2032, $2033, $0000, + $271d, $0000, $25ac, $25c0, $25b6, $25cf, $25ae, $25e6, + $25ab, $25ad, $25b3, $25bd, $2606, $2022, $25aa, $25b2, + $25bc, $261c, $261e, $2663, $2666, $2665, $0000, $2720, + $2020, $2021, $2713, $2717, $266f, $266d, $2642, $2640, + $260e, $2315, $2117, $2038, $201a, $201e ); + +// APL Byte 3 = $0b = 11 + keymap11 : array[163..252] of unichar = ( + $003c, $0000, $0000, $003e, $0000, $2228, $2227, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $00af, $0000, $22a5, + $2229, $230a, $0000, $005f, $0000, $0000, $0000, $2218, + $0000, $2395, $0000, $22a4, $25cb, $0000, $0000, $0000, + $2308, $0000, $0000, $222a, $0000, $2283, $0000, $2282, + $0000, $22a2, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $22a3 ); + +// Hebrew Byte 3 = $0c = 12 + keymap12 : array[223..250] of unichar = ( + $2017, $05d0, $05d1, $05d2, $05d3, $05d4, $05d5, $05d6, + $05d7, $05d8, $05d9, $05da, $05db, $05dc, $05dd, $05de, + $05df, $05e0, $05e1, $05e2, $05e3, $05e4, $05e5, $05e6, + $05e7, $05e8, $05e9, $05ea ); + +// Thai Byte 3 = $0d = 13 + keymap13 : array[161..249] of unichar = ( + $0e01, $0e02, $0e03, $0e04, $0e05, $0e06, $0e07, $0e08, + $0e09, $0e0a, $0e0b, $0e0c, $0e0d, $0e0e, $0e0f, $0e10, + $0e11, $0e12, $0e13, $0e14, $0e15, $0e16, $0e17, $0e18, + $0e19, $0e1a, $0e1b, $0e1c, $0e1d, $0e1e, $0e1f, $0e20, + $0e21, $0e22, $0e23, $0e24, $0e25, $0e26, $0e27, $0e28, + $0e29, $0e2a, $0e2b, $0e2c, $0e2d, $0e2e, $0e2f, $0e30, + $0e31, $0e32, $0e33, $0e34, $0e35, $0e36, $0e37, $0e38, + $0e39, $0e3a, $0000, $0000, $0000, $0000, $0e3f, $0e40, + $0e41, $0e42, $0e43, $0e44, $0e45, $0e46, $0e47, $0e48, + $0e49, $0e4a, $0e4b, $0e4c, $0e4d, $0000, $0000, $0e50, + $0e51, $0e52, $0e53, $0e54, $0e55, $0e56, $0e57, $0e58, + $0e59 ); + +// Korean Byte 3 = $0e = 14 + keymap14 : array[161..255] of unichar = ( + $3131, $3132, $3133, $3134, $3135, $3136, $3137, $3138, + $3139, $313a, $313b, $313c, $313d, $313e, $313f, $3140, + $3141, $3142, $3143, $3144, $3145, $3146, $3147, $3148, + $3149, $314a, $314b, $314c, $314d, $314e, $314f, $3150, + $3151, $3152, $3153, $3154, $3155, $3156, $3157, $3158, + $3159, $315a, $315b, $315c, $315d, $315e, $315f, $3160, + $3161, $3162, $3163, $11a8, $11a9, $11aa, $11ab, $11ac, + $11ad, $11ae, $11af, $11b0, $11b1, $11b2, $11b3, $11b4, + $11b5, $11b6, $11b7, $11b8, $11b9, $11ba, $11bb, $11bc, + $11bd, $11be, $11bf, $11c0, $11c1, $11c2, $316d, $3171, + $3178, $317f, $3181, $3184, $3186, $318d, $318e, $11eb, + $11f0, $11f9, $0000, $0000, $0000, $0000, $20a9 ); + +// missing: +// Latin-8 Byte 3 = $12 = 18 + +// Latin-9 Byte 3 = $13 = 19 + keymap19 : array[188..190] of unichar = ( + $0152, $0153, $0178 ); + +// missing: +// Armenian Byte 3 = $14 = 20 +// Georgian Byte 3 = $15 = 21 +// Azeri Byte 3 = $16 = 22 +// Vietnamese Byte 3 = $1e = 30 + +// Currency Byte 3 = $20 = 32 + keymap32 : array[160..172] of unichar = ( + $20a0, $20a1, $20a2, $20a3, $20a4, $20a5, $20a6, $20a7, + $20a8, $0000, $20aa, $20ab, $20ac ); + +// Keyboard (Keypad mappings) Byte 3 = $ff = 255 + keymap255 : array[128..189] of unichar = ( + $0020, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $FF0D, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $002a, $002b, $002c, $002d, $002e, $002f, + $0030, $0031, $0032, $0033, $0034, $0035, $0036, $0037, + $0038, $0039, $0000, $0000, $0000, $003d ); + +type + keymap = array[0..255] of word; + mapptr = ^keymap; + +procedure TranslateCode(var res : word; ccode : byte; map : mapptr; lowind,highind : byte); +begin + //writeln('code: ',ccode,' low: ',lowind,' high: ',highind); + if (ccode >= lowind) and (ccode <= highind) then res := map^[ccode-lowind]; +end; + +procedure KeySymToUnicode(ks : longword; res : PWord); +var + table : byte; + ccode : byte; +begin + table := ((ks and $0000FF00) shr 8); + ccode := ks and $ff; + res^ := ks and $FFFF; + case table of + 00 : TranslateCode(res^, ccode, @keymap00, low(keymap00), high(keymap00) ); + 01 : TranslateCode(res^, ccode, @keymap01, low(keymap01), high(keymap01) ); + 02 : TranslateCode(res^, ccode, @keymap02, low(keymap01), high(keymap02) ); + 03 : TranslateCode(res^, ccode, @keymap03, low(keymap01), high(keymap03) ); + 04 : TranslateCode(res^, ccode, @keymap04, low(keymap01), high(keymap04) ); + 05 : TranslateCode(res^, ccode, @keymap05, low(keymap01), high(keymap05) ); + 06 : TranslateCode(res^, ccode, @keymap06, low(keymap01), high(keymap06) ); + 07 : TranslateCode(res^, ccode, @keymap07, low(keymap01), high(keymap07) ); + 08 : TranslateCode(res^, ccode, @keymap08, low(keymap01), high(keymap08) ); + 09 : TranslateCode(res^, ccode, @keymap09, low(keymap01), high(keymap09) ); + + 10 : TranslateCode(res^, ccode, @keymap10, low(keymap10), high(keymap10) ); + 11 : TranslateCode(res^, ccode, @keymap11, low(keymap11), high(keymap11) ); + 12 : TranslateCode(res^, ccode, @keymap12, low(keymap12), high(keymap12) ); + 13 : TranslateCode(res^, ccode, @keymap13, low(keymap13), high(keymap13) ); + 14 : TranslateCode(res^, ccode, @keymap14, low(keymap14), high(keymap14) ); +// 15 : TranslateCode(res^, ccode, @keymap15, low(keymap15), high(keymap15) ); +// 16 : TranslateCode(res^, ccode, @keymap16, low(keymap16), high(keymap16) ); +// 17 : TranslateCode(res^, ccode, @keymap17, low(keymap17), high(keymap17) ); +// 18 : TranslateCode(res^, ccode, @keymap18, low(keymap18), high(keymap18) ); + 19 : TranslateCode(res^, ccode, @keymap19, low(keymap19), high(keymap19) ); + + 32 : TranslateCode(res^, ccode, @keymap32, low(keymap32), high(keymap32) ); + + 255 : TranslateCode(res^, ccode, @keymap255, low(keymap255), high(keymap255) ); + end; +end; + +end. diff --git a/gfx/x11/Makefile b/gfx/x11/Makefile new file mode 100644 index 00000000..a4d1387d --- /dev/null +++ b/gfx/x11/Makefile @@ -0,0 +1,1985 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/08/28] +# +default: all +MAKEFILETARGETS=i386-linux +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=/opt/fpc/src +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +FPC:=$(shell $(FPCPROG) -PB) +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +FOUNDFPC:=$(strip $(wildcard $(FPC))) +ifeq ($(FOUNDFPC),) +FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))) +ifeq ($(FOUNDFPC),) +$(error Compiler $(FPC) not found) +endif +endif +ifndef FPC_COMPILERINFO +FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO) +endif +ifndef FPC_VERSION +FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO)) +endif +export FPC FPC_VERSION FPC_COMPILERINFO +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +OS_TARGET:=$(word 5,$(FPC_COMPILERINFO)) +endif +FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +TARGETSUFFIX=$(OS_TARGET) +SOURCESUFFIX=$(OS_SOURCE) +else +TARGETSUFFIX=$(FULL_TARGET) +SOURCESUFFIX=$(FULL_SOURCE) +endif +ifneq ($(FULL_TARGET),$(FULL_SOURCE)) +CROSSCOMPILE=1 +endif +ifeq ($(findstring makefile,$(MAKECMDGOALS)),) +ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +override PACKAGE_NAME=fpgfx +override PACKAGE_VERSION=0.2 +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_UNITS+=gfx_x11 gfximpl +endif +override INSTALL_FPCPACKAGE=y +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_OPTIONS+=-S2h +endif +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_UNITDIR+=.. ../emulayer +endif +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_UNITTARGETDIR+=../units +endif +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef COMPILER_UNITTARGETDIR +ifdef PACKAGEDIR_MAIN +COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX) +else +COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX) +endif +endif +ifndef COMPILER_TARGETDIR +COMPILER_TARGETDIR=. +endif +ifndef INSTALL_BASEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +ifdef CROSSCOMPILE +ifdef CROSSINSTALL +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX) +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +endif +endif +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +endif +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +FPCMADE=fpcmade.$(SHORTSUFFIX) +ZIPSUFFIX=$(SHORTSUFFIX) +ZIPCROSSPREFIX= +ZIPSOURCESUFFIX=src +ZIPEXAMPLESUFFIX=exm +else +FPCMADE=fpcmade.$(TARGETSUFFIX) +ZIPSOURCESUFFIX=.source +ZIPEXAMPLESUFFIX=.examples +ifdef CROSSCOMPILE +ZIPSUFFIX=.$(SOURCESUFFIX) +ZIPCROSSPREFIX=$(TARGETSUFFIX)- +else +ZIPSUFFIX=.$(TARGETSUFFIX) +ZIPCROSSPREFIX= +endif +endif +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= __missing_command_MVPROG +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef MKDIRPROG +MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG= __missing_command_MKDIRPROG +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +endif +export MKDIRPROG +ifndef ECHOREDIR +ifndef inUnix +ECHOREDIR=echo +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= __missing_command_PPUMOVE +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl fcl +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_NETDB=1 +REQUIRE_PACKAGES_LIBASYNC=1 +REQUIRE_PACKAGES_PTHREADS=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_PASJPEG=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_POSTGRES=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_ODBC=1 +REQUIRE_PACKAGES_ORACLE=1 +REQUIRE_PACKAGES_SQLITE=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_RTL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE) +endif +else +PACKAGEDIR_RTL= +UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_RTL),) +UNITDIR_RTL:=$(firstword $(UNITDIR_RTL)) +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override COMPILER_UNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef REQUIRE_PACKAGES_HASH +PACKAGEDIR_HASH:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /hash/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_HASH),) +ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)),) +UNITDIR_HASH=$(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX) +else +UNITDIR_HASH=$(PACKAGEDIR_HASH) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_HASH)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_HASH) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_HASH)/$(FPCMADE) +endif +else +PACKAGEDIR_HASH= +UNITDIR_HASH:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /hash/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_HASH),) +UNITDIR_HASH:=$(firstword $(UNITDIR_HASH)) +else +UNITDIR_HASH= +endif +endif +ifdef UNITDIR_HASH +override COMPILER_UNITDIR+=$(UNITDIR_HASH) +endif +endif +ifdef REQUIRE_PACKAGES_PASZLIB +PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PASZLIB)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PASZLIB) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PASZLIB)/$(FPCMADE) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_NETDB +PACKAGEDIR_NETDB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /netdb/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_NETDB),) +ifneq ($(wildcard $(PACKAGEDIR_NETDB)/units/$(TARGETSUFFIX)),) +UNITDIR_NETDB=$(PACKAGEDIR_NETDB)/units/$(TARGETSUFFIX) +else +UNITDIR_NETDB=$(PACKAGEDIR_NETDB) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_NETDB)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_NETDB) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_NETDB)/$(FPCMADE) +endif +else +PACKAGEDIR_NETDB= +UNITDIR_NETDB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /netdb/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_NETDB),) +UNITDIR_NETDB:=$(firstword $(UNITDIR_NETDB)) +else +UNITDIR_NETDB= +endif +endif +ifdef UNITDIR_NETDB +override COMPILER_UNITDIR+=$(UNITDIR_NETDB) +endif +endif +ifdef REQUIRE_PACKAGES_LIBASYNC +PACKAGEDIR_LIBASYNC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /libasync/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_LIBASYNC),) +ifneq ($(wildcard $(PACKAGEDIR_LIBASYNC)/units/$(TARGETSUFFIX)),) +UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC)/units/$(TARGETSUFFIX) +else +UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_LIBASYNC)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_LIBASYNC) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_LIBASYNC)/$(FPCMADE) +endif +else +PACKAGEDIR_LIBASYNC= +UNITDIR_LIBASYNC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /libasync/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_LIBASYNC),) +UNITDIR_LIBASYNC:=$(firstword $(UNITDIR_LIBASYNC)) +else +UNITDIR_LIBASYNC= +endif +endif +ifdef UNITDIR_LIBASYNC +override COMPILER_UNITDIR+=$(UNITDIR_LIBASYNC) +endif +endif +ifdef REQUIRE_PACKAGES_PTHREADS +PACKAGEDIR_PTHREADS:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pthreads/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_PTHREADS),) +ifneq ($(wildcard $(PACKAGEDIR_PTHREADS)/units/$(TARGETSUFFIX)),) +UNITDIR_PTHREADS=$(PACKAGEDIR_PTHREADS)/units/$(TARGETSUFFIX) +else +UNITDIR_PTHREADS=$(PACKAGEDIR_PTHREADS) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PTHREADS)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PTHREADS) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PTHREADS)/$(FPCMADE) +endif +else +PACKAGEDIR_PTHREADS= +UNITDIR_PTHREADS:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /pthreads/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PTHREADS),) +UNITDIR_PTHREADS:=$(firstword $(UNITDIR_PTHREADS)) +else +UNITDIR_PTHREADS= +endif +endif +ifdef UNITDIR_PTHREADS +override COMPILER_UNITDIR+=$(UNITDIR_PTHREADS) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_FCL),) +ifneq ($(wildcard $(PACKAGEDIR_FCL)/units/$(TARGETSUFFIX)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/units/$(TARGETSUFFIX) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_FCL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_FCL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL)/$(FPCMADE) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_PASJPEG +PACKAGEDIR_PASJPEG:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pasjpeg/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_PASJPEG),) +ifneq ($(wildcard $(PACKAGEDIR_PASJPEG)/units/$(TARGETSUFFIX)),) +UNITDIR_PASJPEG=$(PACKAGEDIR_PASJPEG)/units/$(TARGETSUFFIX) +else +UNITDIR_PASJPEG=$(PACKAGEDIR_PASJPEG) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PASJPEG)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PASJPEG) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PASJPEG)/$(FPCMADE) +endif +else +PACKAGEDIR_PASJPEG= +UNITDIR_PASJPEG:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /pasjpeg/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASJPEG),) +UNITDIR_PASJPEG:=$(firstword $(UNITDIR_PASJPEG)) +else +UNITDIR_PASJPEG= +endif +endif +ifdef UNITDIR_PASJPEG +override COMPILER_UNITDIR+=$(UNITDIR_PASJPEG) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_IBASE),) +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/units/$(TARGETSUFFIX)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/units/$(TARGETSUFFIX) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_IBASE)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_IBASE) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_IBASE)/$(FPCMADE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +ifdef REQUIRE_PACKAGES_POSTGRES +PACKAGEDIR_POSTGRES:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /postgres/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_POSTGRES),) +ifneq ($(wildcard $(PACKAGEDIR_POSTGRES)/units/$(TARGETSUFFIX)),) +UNITDIR_POSTGRES=$(PACKAGEDIR_POSTGRES)/units/$(TARGETSUFFIX) +else +UNITDIR_POSTGRES=$(PACKAGEDIR_POSTGRES) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_POSTGRES)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_POSTGRES) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_POSTGRES)/$(FPCMADE) +endif +else +PACKAGEDIR_POSTGRES= +UNITDIR_POSTGRES:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /postgres/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_POSTGRES),) +UNITDIR_POSTGRES:=$(firstword $(UNITDIR_POSTGRES)) +else +UNITDIR_POSTGRES= +endif +endif +ifdef UNITDIR_POSTGRES +override COMPILER_UNITDIR+=$(UNITDIR_POSTGRES) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_MYSQL),) +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/units/$(TARGETSUFFIX)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/units/$(TARGETSUFFIX) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_MYSQL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_MYSQL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_MYSQL)/$(FPCMADE) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_ODBC +PACKAGEDIR_ODBC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /odbc/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_ODBC),) +ifneq ($(wildcard $(PACKAGEDIR_ODBC)/units/$(TARGETSUFFIX)),) +UNITDIR_ODBC=$(PACKAGEDIR_ODBC)/units/$(TARGETSUFFIX) +else +UNITDIR_ODBC=$(PACKAGEDIR_ODBC) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_ODBC)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_ODBC) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_ODBC)/$(FPCMADE) +endif +else +PACKAGEDIR_ODBC= +UNITDIR_ODBC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /odbc/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_ODBC),) +UNITDIR_ODBC:=$(firstword $(UNITDIR_ODBC)) +else +UNITDIR_ODBC= +endif +endif +ifdef UNITDIR_ODBC +override COMPILER_UNITDIR+=$(UNITDIR_ODBC) +endif +endif +ifdef REQUIRE_PACKAGES_ORACLE +PACKAGEDIR_ORACLE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /oracle/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_ORACLE),) +ifneq ($(wildcard $(PACKAGEDIR_ORACLE)/units/$(TARGETSUFFIX)),) +UNITDIR_ORACLE=$(PACKAGEDIR_ORACLE)/units/$(TARGETSUFFIX) +else +UNITDIR_ORACLE=$(PACKAGEDIR_ORACLE) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_ORACLE)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_ORACLE) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_ORACLE)/$(FPCMADE) +endif +else +PACKAGEDIR_ORACLE= +UNITDIR_ORACLE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /oracle/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_ORACLE),) +UNITDIR_ORACLE:=$(firstword $(UNITDIR_ORACLE)) +else +UNITDIR_ORACLE= +endif +endif +ifdef UNITDIR_ORACLE +override COMPILER_UNITDIR+=$(UNITDIR_ORACLE) +endif +endif +ifdef REQUIRE_PACKAGES_SQLITE +PACKAGEDIR_SQLITE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /sqlite/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_SQLITE),) +ifneq ($(wildcard $(PACKAGEDIR_SQLITE)/units/$(TARGETSUFFIX)),) +UNITDIR_SQLITE=$(PACKAGEDIR_SQLITE)/units/$(TARGETSUFFIX) +else +UNITDIR_SQLITE=$(PACKAGEDIR_SQLITE) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_SQLITE)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_SQLITE) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_SQLITE)/$(FPCMADE) +endif +else +PACKAGEDIR_SQLITE= +UNITDIR_SQLITE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /sqlite/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_SQLITE),) +UNITDIR_SQLITE:=$(firstword $(UNITDIR_SQLITE)) +else +UNITDIR_SQLITE= +endif +endif +ifdef UNITDIR_SQLITE +override COMPILER_UNITDIR+=$(UNITDIR_SQLITE) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O1r +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif +.PHONY: fpc_units +ifneq ($(TARGET_UNITS),) +override ALLTARGET+=fpc_units +override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS)) +override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS)) +override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES) +override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES) +endif +fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/../fpc-pack +else +PACKDIR=/tmp/fpc-pack +endif +endif +ifndef ZIPNAME +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(PACKAGE_NAME) +endif +endif +ifndef FULLZIPNAME +FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX) +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install +endif +endif +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif +ifndef inUnix +USEZIPWRAPPER=1 +endif +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) +ifdef USETAR +ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT) +ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * +else +ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +endif +fpc_zipinstall: + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 + $(MKDIR) $(DIST_DESTDIR) + $(DEL) $(ZIPDESTFILE) +ifdef USEZIPWRAPPER +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) +else + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) +endif +ifdef inUnix + /bin/sh $(ZIPWRAPPER) +else + $(ZIPWRAPPER) +endif + $(DEL) $(ZIPWRAPPER) +else + $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) +endif + $(DELTREE) $(PACKDIR) +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX) +fpc_zipexampleinstall: +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX) +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +fpc_cleanall: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef COMPILER_UNITTARGETDIR +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +endif + -$(DELTREE) units + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) +ifneq ($(PPUEXT),.ppu) + -$(DEL) *.o *.ppu *.a +endif + -$(DELTREE) *$(SMARTEXT) + -$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(ECHO) Target OS.... $(OS_TARGET) + @$(ECHO) Full Source.. $(FULL_SOURCE) + @$(ECHO) Full Target.. $(FULL_TARGET) + @$(ECHO) SourceSuffix. $(SOURCESUFFIX) + @$(ECHO) TargetSuffix. $(TARGETSUFFIX) + @$(ECHO) + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) + @$(ECHO) DateStr.............. $(DATESTR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipCrossPrefix....... $(ZIPCROSSPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) FullZipName.......... $(FULLZIPNAME) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) + @$(ECHO) + @$(ECHO) Install base dir..... $(INSTALL_BASEDIR) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +all: fpc_all +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall +zipdistinstall: fpc_zipdistinstall +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_makefiles +.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif diff --git a/gfx/x11/Makefile.fpc b/gfx/x11/Makefile.fpc new file mode 100644 index 00000000..dcc60812 --- /dev/null +++ b/gfx/x11/Makefile.fpc @@ -0,0 +1,27 @@ +# +# Makefile.fpc for fpGFX X11 target +# + +[package] +name=fpgfx +version=0.3 + +[require] +packages=fcl +unitdir=.. ../emulayer + +[target] +units=gfx_x11 gfxinterface +rst=gfx_x11 + +[compiler] +unitdir=.. ../emulayer +unittargetdir=../units +options=-S2h + +[install] +fpcpackage=y + +[default] +fpcdir=/opt/fpc/src + diff --git a/gfx/x11/fpgfxpackage.lpk b/gfx/x11/fpgfxpackage.lpk new file mode 100644 index 00000000..ee49e142 --- /dev/null +++ b/gfx/x11/fpgfxpackage.lpk @@ -0,0 +1,72 @@ +<?xml version="1.0"?> +<CONFIG> + <Package Version="2"> + <Name Value="fpgfxpackage"/> + <Author Value="Graeme Geldenhuys"/> + <CompilerOptions> + <Version Value="5"/> + <SearchPaths> + <OtherUnitFiles Value="../;../emulayer/"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Description Value="Free Pascal GFX Library - [Linux] +"/> + <License Value="LGPL +"/> + <Version Minor="3"/> + <Files Count="8"> + <Item1> + <Filename Value="../gfxbase.pas"/> + <UnitName Value="GfxBase"/> + </Item1> + <Item2> + <Filename Value="../emulayer/geldirty.pas"/> + <UnitName Value="GELDirty"/> + </Item2> + <Item3> + <Filename Value="../emulayer/gelimage.pas"/> + <UnitName Value="GELImage"/> + </Item3> + <Item4> + <Filename Value="gfx_x11.pas"/> + <UnitName Value="GFX_X11"/> + </Item4> + <Item5> + <Filename Value="gfxinterface.pas"/> + <UnitName Value="gfxinterface"/> + </Item5> + <Item6> + <Filename Value="../schar16.pas"/> + <UnitName Value="schar16"/> + </Item6> + <Item7> + <Filename Value="../unitkeys.pas"/> + <UnitName Value="unitkeys"/> + </Item7> + <Item8> + <Filename Value="../fpgfx.pas"/> + <UnitName Value="fpgfx"/> + </Item8> + </Files> + <RequiredPkgs Count="1"> + <Item1> + <PackageName Value="FCL"/> + <MinVersion Major="1" Valid="True"/> + </Item1> + </RequiredPkgs> + <UsageOptions> + <UnitPath Value="$(PkgOutDir)/"/> + </UsageOptions> + <PublishOptions> + <Version Value="2"/> + <IgnoreBinaries Value="False"/> + </PublishOptions> + </Package> +</CONFIG> diff --git a/gfx/x11/fpgfxpackage.pas b/gfx/x11/fpgfxpackage.pas new file mode 100644 index 00000000..24a9b9dc --- /dev/null +++ b/gfx/x11/fpgfxpackage.pas @@ -0,0 +1,14 @@ +{ This file was automatically created by Lazarus. Do not edit! +This source is only used to compile and install the package. + } + +unit fpgfxpackage; + +interface + +uses + GfxBase, GELDirty, GELImage, GFX_X11, gfxinterface, schar16, unitkeys, fpgfx; + +implementation + +end. diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas new file mode 100644 index 00000000..ac74f781 --- /dev/null +++ b/gfx/x11/gfx_x11.pas @@ -0,0 +1,1865 @@ +{ + fpGFX - Free Pascal Graphics Library + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + + X11/XLib target implementation + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about the copyright. + + 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. +} + + +unit GFX_X11; + +{$IFDEF Debug} + {$ASSERTIONS On} +{$ENDIF} + +{$mode objfpc}{$H+} + +{ Disable this, if you do not want Xft to be used for drawing text } +{.$Define XftSupport} + +interface + +uses + SysUtils, Classes, // FPC units + X, XLib, XUtil, // X11 units + {$IFDEF XftSupport} + unitxft; // Xft font support + {$ENDIF} + GfxBase, // fpGFX units + GELDirty; // fpGFX emulation layer + + +resourcestring + // X11 exception strings + SGCCreationFailed = 'Creation of X11 graphics context failed'; + SXCanvasInvalidFontClass = 'Tried to set font of class "%s" into X11 context; only TXFont is allowed.'; + SOpenDisplayFailed = 'Opening of display "%s" failed'; + SWindowCreationFailed = 'Creation of X11 window failed'; + SWindowUnsupportedPixelFormat = 'Window uses unsupported pixel format: %d bits per pixel'; + SNoDefaultFont = 'Unable to load default font'; + SIncompatibleCanvasForBlitting = 'Cannot blit from %s to %s'; + + +type + EX11Error = class(EGfxError); + TX11Canvas = class; + TX11Application = class; + + // Returns True if it 'ate' the event + TX11EventFilter = function (const AEvent: TXEvent): Boolean of object; + + { TX11Font } + + TX11Font = class(TFCustomFont) + private + FFontStruct: PXFontStruct; + public + constructor Create(const Descriptor: String); + destructor Destroy; override; + class function GetDefaultFontName(const AFontClass: TGfxFontClass): String; override; + property FontStruct: PXFontStruct read FFontStruct; + end; + + + PX11CanvasState = ^TX11CanvasState; + TX11CanvasState = record + Prev: PX11CanvasState; + Matrix: TGfxMatrix; + Region: TRegion; + Color: TGfxPixel; + Font: TFCustomFont; + end; + + + { TX11Canvas } + + TX11Canvas = class(TFCustomCanvas) + private + FHandle: X.TDrawable; + FGC: TGC; + FVisual: PVisual; + FRegion: TRegion; + FDefaultFont: PXFontStruct; + FFontStruct: PXFontStruct; + FStateStackpointer: PX11CanvasState; + FColormap: TColormap; + FCurColor: TGfxPixel; + FFont: TFCustomFont; + {$IFDEF XftSupport} + FXftDraw: PXftDraw; + {$ENDIF} + procedure Resized(NewWidth, NewHeight: Integer); + protected + function DoExcludeClipRect(const ARect: TRect): Boolean; override; + function DoIntersectClipRect(const ARect: TRect): Boolean; override; + function DoUnionClipRect(const ARect: TRect): Boolean; override; + function DoGetClipRect: TRect; override; + procedure DoDrawArc(const ARect: TRect; StartAngle, EndAngle: Single); override; + procedure DoDrawCircle(const ARect: TRect); override; + procedure DoDrawLine(const AFrom, ATo: TPoint); override; + procedure DoDrawRect(const ARect: TRect); override; + procedure DoDrawPoint(const APoint: TPoint); override; + procedure DoFillRect(const ARect: TRect); override; + procedure DoTextOut(const APosition: TPoint; const AText: String); override; + procedure DoCopyRect(ASource: TFCustomCanvas; const ASourceRect: TRect; const ADestPos: TPoint); override; + procedure DoMaskedCopyRect(ASource, AMask: TFCustomCanvas; const ASourceRect: TRect; const AMaskPos, ADestPos: TPoint); override; + procedure DoDrawImageRect(AImage: TFCustomImage; ASourceRect: TRect; const ADestPos: TPoint); override; + public + constructor Create(AColormap: TColormap; AXDrawable: X.TDrawable; ADefaultFont: PXFontStruct); + destructor Destroy; override; + function MapColor(const AColor: TGfxColor): TGfxPixel; override; + function FontCellHeight: Integer; override; + function TextExtent(const AText: String): TSize; override; + procedure SaveState; override; + procedure RestoreState; override; + procedure EmptyClipRect; override; + procedure SetColor_(AColor: TGfxPixel); override; + procedure SetFont(AFont: TFCustomFont); override; + procedure SetLineStyle(ALineStyle: TGfxLineStyle); override; + procedure DrawPolyLine(const Coords: array of TPoint); override; + property Handle: X.TDrawable read FHandle; + property GC: TGC read FGC; + property Visual: PVisual read FVisual; + property Colormap: TColormap read FColormap; + property Region: TRegion read FRegion; + end; + + + TX11WindowCanvas = class(TX11Canvas) + public + constructor Create(AColormap: TColormap; + AXDrawable: X.TDrawable; ADefaultFont: PXFontStruct); + end; + + + TX11PixmapCanvas = class(TX11Canvas) + public + constructor Create(AColormap: TColormap; + AHandle: TPixmap; APixelFormat: TGfxPixelFormat); + destructor Destroy; override; + end; + + + TX11MonoPixmapCanvas = class(TX11PixmapCanvas) + constructor Create(AColormap: TColormap; AHandle: TPixmap); + end; + + + TX11Image = class(TFCustomImage) + private + IsLocked: Boolean; + protected + FStride: LongWord; + FData: Pointer; + public + constructor Create(AWidth, AHeight: Integer; APixelFormat: TGfxPixelFormat); override; + destructor Destroy; override; + procedure Lock(var AData: Pointer; var AStride: LongWord); override; + procedure Unlock; override; + property Stride: LongWord read FStride; + property Data: Pointer read FData; + end; + + { TX11Screen } + + TX11Screen = class(TFCustomScreen) + private + FScreenIndex: Integer; + FScreenInfo: PScreen; + public + constructor Create; override; + property ScreenIndex: Integer read FScreenIndex; + property ScreenInfo: PScreen read FScreenInfo; + end; + + + TX11Window = class; + + + PXWindowListEntry = ^TXWindowListEntry; + TXWindowListEntry = record + GfxWindow: TFCustomWindow; + XWindowID: X.TWindow; + end; + + + { TX11Application } + + TX11Application = class(TFCustomApplication) + private + DoBreakRun: Boolean; + FDirtyList: TDirtyList; + FDisplayName: String; + FDefaultFont: PXFontStruct; + FEventFilter: TX11EventFilter; + Handle: PDisplay; + FWMProtocols: TAtom; // Atom for "WM_PROTOCOLS" + FWMDeleteWindow: TAtom; // Atom for "WM_DELETE_WINDOW" + FWMHints: TAtom; // Atom for "_MOTIF_WM_HINTS" + property DirtyList: TDirtyList read FDirtyList; + function FindWindowByXID(XWindowID: X.TWindow): PXWindowListEntry; + public + { default methods } + constructor Create; override; + destructor Destroy; override; + procedure AddWindow(AWindow: TFCustomWindow); override; + procedure Initialize(ADisplayName: String = ''); override; + procedure Run; override; + procedure Quit; override; + { properties } + property DisplayName: String read FDisplayName write FDisplayName; + property EventFilter: TX11EventFilter read FEventFilter write FEventFilter; + end; + + { TX11Window } + + TX11Window = class(TFCustomWindow) + private + FParent: TFCustomWindow; + FComposeStatus: TXComposeStatus; + FComposeBuffer: String[32]; + FCurCursorHandle: X.TCursor; + function StartComposing(const Event: TXKeyEvent): TKeySym; + procedure EndComposing; + procedure KeyPressed(var Event: TXKeyPressedEvent); message X.KeyPress; + procedure KeyReleased(var Event: TXKeyReleasedEvent); message X.KeyRelease; + procedure ButtonPressed(var Event: TXButtonPressedEvent); message X.ButtonPress; + procedure ButtonReleased(var Event: TXButtonReleasedEvent); message X.ButtonRelease; + procedure EnterWindow(var Event :TXEnterWindowEvent); message X.EnterNotify; + procedure LeaveWindow(var Event :TXLeaveWindowEvent); message X.LeaveNotify; + procedure PointerMoved(var Event: TXPointerMovedEvent); message X.MotionNotify; + procedure Expose(var Event: TXExposeEvent); message X.Expose; + procedure FocusIn(var Event: TXFocusInEvent); message X.FocusIn; + procedure FocusOut(var Event: TXFocusOutEvent); message X.FocusOut; + procedure Map(var Event: TXMapEvent); message X.MapNotify; + procedure Unmap(var Event: TXUnmapEvent); message X.UnmapNotify; + procedure Reparent(var Event: TXReparentEvent); message X.ReparentNotify; + procedure Configure(var Event: TXConfigureEvent); message X.ConfigureNotify; + procedure ClientMessage(var Event: TXClientMessageEvent); message X.ClientMessage; + protected + IsExposing: Boolean; + CanMaximize: Boolean; + function CreateXWindow(AParent: X.TWindow; ALeft, ATop: longint; AWidth, AHeight: longword; AVisual: PVisual; AValueMask: LongWord; const AAttr: TXSetWindowAttributes): X.TWindow; virtual; + function GetTitle: String; override; + function ConvertShiftState(AState: Cardinal): TShiftState; + function KeySymToKeycode(KeySym: TKeySym): Word; + procedure SetTitle(const ATitle: String); override; + procedure DoSetCursor; override; + procedure UpdateMotifWMHints; + public + constructor Create(AParent: TFCustomWindow; AWindowOptions: TGfxWindowOptions); + destructor Destroy; override; + procedure DefaultHandler(var Message); override; + procedure SetPosition(const APosition: TPoint); override; + procedure SetSize(const ASize: TSize); override; + procedure SetMinMaxSize(const AMinSize, AMaxSize: TSize); override; + procedure SetClientSize(const ASize: TSize); override; + procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); override; + procedure Show; override; + procedure Invalidate(const ARect: TRect); override; + procedure PaintInvalidRegion; override; + procedure CaptureMouse; override; + procedure ReleaseMouse; override; + end; + + +var + LeaderWindow: X.TWindow; + ClientLeaderAtom: TAtom; + +function RectToXRect(const ARect: TRect): TXRectangle; +function XRectToRect(const ARect: TXRectangle): TRect; +function GetXEventName(Event: LongInt): String; + + +implementation + +uses + GELImage, fpgfx; + +resourcestring + SFontCreationFailed = 'Could not create font with descriptor "%s"'; + +{ TX11Font } + +constructor TX11Font.Create(const Descriptor: String); +begin + inherited Create; + + FFontStruct := XLoadQueryFont(gApplication.Handle, PChar(Descriptor)); + if not Assigned(FFontStruct) then + raise EX11Error.CreateFmt(SFontCreationFailed, [Descriptor]); +end; + +destructor TX11Font.Destroy; +begin + if Assigned(FontStruct) then + begin + if FontStruct^.fid <> 0 then + XUnloadFont(gApplication.Handle, FontStruct^.fid); + XFreeFontInfo(nil, FontStruct, 0); + end; + inherited Destroy; +end; + +class function TX11Font.GetDefaultFontName(const AFontClass: TGfxFontClass): String; +const + FontNames: array[TGfxFontClass] of String = ( + 'times', 'bitstream vera sans', 'courier', 'symbol'); +begin + Result := FontNames[AFontClass]; +end; + + +{ TX11Canvas } + +constructor TX11Canvas.Create(AColormap: TColormap; AXDrawable: X.TDrawable; ADefaultFont: PXFontStruct); +var + DummyWnd: PWindow; + DummyInt: LongInt; + GCValues: XLib.TXGCValues; +begin + inherited Create; + FColormap := AColormap; + FHandle := AXDrawable; + FDefaultFont := ADefaultFont; + XGetGeometry(gApplication.Handle, Handle, @DummyWnd, @DummyInt, @DummyInt, + @FWidth, @FHeight, @DummyInt, @DummyInt); + + GCValues.graphics_exposures := False; + FGC := XCreateGC(gApplication.Handle, Handle, GCGraphicsExposures, @GCValues); + if not Assigned(GC) then + raise EX11Error.Create(SGCCreationFailed); + + XSetLineAttributes(gApplication.Handle, GC, 0, + LineSolid, CapNotLast, JoinMiter); + + FFontStruct := FDefaultFont; + if Assigned(FFontStruct) then + XSetFont(gApplication.Handle, GC, FFontStruct^.FID); + + FRegion := XCreateRegion; + Resized(Width, Height); // Set up a proper clipping region + + {$IFDEF XftSupport} + {$IFDEF BUFFERING} + FBufferWin := XdbeAllocateBackBufferName(gApplication, FWin, nil); + if FBufferWin > 0 then + FXftDrawBuffer := XftDrawCreate(gApplication.Handle, FBufferWin, + XDefaultVisual(gApplication.Handle, GfxDefaultScreen), + XDefaultColormap(gApplication.Handle, GfxDefaultScreen)); + {$ELSE} + // FBufferWin := -1; + // FXftDrawBuffer := nil; + {$ENDIF} + FXftDraw := XftDrawCreate(gApplication.Handle, Handle, + XDefaultVisual(gApplication.Handle, XDefaultScreen(gApplication.Handle)), + XDefaultColormap(gApplication.Handle, XDefaultScreen(gApplication.Handle))); + {$ENDIF XftSupport} +end; + +destructor TX11Canvas.Destroy; +begin + {$IFDEF XftSupport} + if FXftDraw <> nil then + XftDrawDestroy(FXftDraw); + {$ENDIF} + XDestroyRegion(Region); + if Assigned(GC) then + XFreeGC(gApplication.Handle, GC); + inherited Destroy; +end; + +procedure TX11Canvas.SaveState; +var + SavedState: PX11CanvasState; + NewRegion: TRegion; +begin + New(SavedState); + SavedState^.Prev := FStateStackpointer; + SavedState^.Matrix := Matrix; + SavedState^.Region := Region; + NewRegion := XCreateRegion; + XUnionRegion(Region, NewRegion, NewRegion); + FRegion := NewRegion; + SavedState^.Color := FCurColor; + SavedState^.Font := FFont; + FStateStackpointer := SavedState; +end; + +procedure TX11Canvas.RestoreState; +var + SavedState: PX11CanvasState; +begin + SavedState := FStateStackpointer; + FStateStackpointer := SavedState^.Prev; + Matrix := SavedState^.Matrix; + + XDestroyRegion(Region); + FRegion := SavedState^.Region; + XSetRegion(gApplication.Handle, GC, Region); + + SetColor_(SavedState^.Color); + SetFont(SavedState^.Font); + + Dispose(SavedState); +end; + +procedure TX11Canvas.EmptyClipRect; +begin + XDestroyRegion(Region); + FRegion := XCreateRegion; + XSetRegion(gApplication.Handle, GC, Region); +end; + +function TX11Canvas.DoExcludeClipRect(const ARect: TRect): Boolean; +var + RectRegion: TRegion; + XRect: TXRectangle; +begin + XRect := RectToXRect(ARect); + RectRegion := XCreateRegion; + XUnionRectWithRegion(@XRect, RectRegion, RectRegion); + XSubtractRegion(Region, RectRegion, Region); + XDestroyRegion(RectRegion); + XSetRegion(gApplication.Handle, GC, Region); + Result := XEmptyRegion(Region) = 0; +end; + +function TX11Canvas.DoIntersectClipRect(const ARect: TRect): Boolean; +var + RectRegion: TRegion; + XRect: TXRectangle; +begin + XRect := RectToXRect(ARect); + RectRegion := XCreateRegion; + XUnionRectWithRegion(@XRect, RectRegion, RectRegion); + XIntersectRegion(Region, RectRegion, Region); + XDestroyRegion(RectRegion); + XSetRegion(gApplication.Handle, GC, Region); + Result := XEmptyRegion(Region) = 0; +end; + +function TX11Canvas.DoUnionClipRect(const ARect: TRect): Boolean; +var + XRect: TXRectangle; +begin + XRect := RectToXRect(ARect); + XUnionRectWithRegion(@XRect, Region, Region); + XSetRegion(gApplication.Handle, GC, Region); + Result := XEmptyRegion(Region) = 0; +end; + +function TX11Canvas.DoGetClipRect: TRect; +var + XRect: TXRectangle; +begin + XClipBox(Region, @XRect); + Result := XRectToRect(XRect); +end; + +function TX11Canvas.MapColor(const AColor: TGfxColor): TGfxPixel; +var + Color: TXColor; +begin + Color.Pixel := 0; + Color.Red := AColor.Red; + Color.Green := AColor.Green; + Color.Blue := AColor.Blue; + XAllocColor(gApplication.Handle, Colormap, @Color); + Result := Color.Pixel; +end; + +procedure TX11Canvas.SetColor_(AColor: TGfxPixel); +begin + if AColor <> FCurColor then + begin + XSetForeground(gApplication.Handle, GC, AColor); + FCurColor := AColor; + end; +end; + +procedure TX11Canvas.SetFont(AFont: TFCustomFont); +begin + if AFont = FFont then + exit; + + FFont := AFont; + + if not Assigned(AFont) then + begin + if FFontStruct = FDefaultFont then + exit; + FFontStruct := FDefaultFont; + end else + begin + if not AFont.InheritsFrom(TX11Font) then + raise EGfxError.CreateFmt(SXCanvasInvalidFontClass, [AFont.ClassName]); + if TX11Font(AFont).FontStruct = FFontStruct then + exit; + FFontStruct := TX11Font(AFont).FontStruct; + end; + XSetFont(gApplication.Handle, GC, FFontStruct^.FID); +end; + +procedure TX11Canvas.SetLineStyle(ALineStyle: TGfxLineStyle); +const + DotDashes: array[0..1] of Char = #4#2; + { It was #1#1 which gives 1 pixel dots. Now it gives a 4 pixel line and a + 2 pixel space. } +begin + case ALineStyle of + lsSolid: + XSetLineAttributes(gApplication.Handle, GC, 0, + LineSolid, CapNotLast, JoinMiter); + lsDot: + begin + XSetLineAttributes(gApplication.Handle, GC, 0, + LineOnOffDash, CapNotLast, JoinMiter); + XSetDashes(gApplication.Handle, GC, 0, DotDashes, 2); + end; + end; +end; + + +procedure TX11Canvas.DoDrawArc(const ARect: TRect; StartAngle, EndAngle: Single); +begin + with ARect do + XDrawArc(gApplication.Handle, Handle, GC, + Left, Top, Right - Left - 1, Bottom - Top - 1, + Round(StartAngle * 64), Round((EndAngle - StartAngle) * 64)); +end; + + +procedure TX11Canvas.DoDrawCircle(const ARect: TRect); +begin + with ARect do + XDrawArc(gApplication.Handle, Handle, GC, + Left, Top, Right - Left - 1, Bottom - Top - 1, 0, 23040); +end; + + +procedure TX11Canvas.DoDrawLine(const AFrom, ATo: TPoint); +begin + XDrawLine(gApplication.Handle, Handle, GC, AFrom.x, AFrom.y, ATo.x, ATo.y); +end; + + +procedure TX11Canvas.DrawPolyLine(const Coords: array of TPoint); +var + Points: PXPoint; + CoordsIndex, PointsIndex: Integer; + Pt: TPoint; +begin + Points := nil; + GetMem(Points, (High(Coords) - Low(Coords) + 1) * SizeOf(TXPoint)); + CoordsIndex := Low(Coords); + PointsIndex := 0; + for CoordsIndex := Low(Coords) to High(Coords) do + begin + Pt := Transform(Coords[CoordsIndex]); + Points[PointsIndex].x := Pt.x; + Points[PointsIndex].y := Pt.y; + Inc(PointsIndex); + end; + + XDrawLines(gApplication.Handle, Handle, GC, Points, PointsIndex, CoordModeOrigin); + + FreeMem(Points); +end; + + +procedure TX11Canvas.DoDrawRect(const ARect: TRect); +begin + with ARect do + XDrawRectangle(gApplication.Handle, Handle, GC, Left, Top, + Right - Left - 1, Bottom - Top - 1); +end; + + +procedure TX11Canvas.DoDrawPoint(const APoint: TPoint); +begin + XDrawPoint(gApplication.Handle, Handle, GC, APoint.x, APoint.y); +end; + + +procedure TX11Canvas.DoFillRect(const ARect: TRect); +begin + with ARect do + XFillRectangle(gApplication.Handle, Handle, GC, Left, Top, + Right - Left, Bottom - Top); +end; + + +function TX11Canvas.FontCellHeight: Integer; +begin + {$note XftSupport needs to be handled here!!! } + Result := FFontStruct^.Ascent + FFontStruct^.Descent; +end; + + +function TX11Canvas.TextExtent(const AText: String): TSize; +var + Direction, FontAscent, FontDescent: LongInt; + CharStruct: TXCharStruct; +begin +// inherited; + if Length(AText) = 0 then + begin + Result.cx := 0; + Result.cy := 0; + end else + begin + XQueryTextExtents(gApplication.Handle, XGContextFromGC(GC), + PChar(AText), Length(AText), + @Direction, @FontAscent, @FontDescent, @CharStruct); + Result.cx := CharStruct.Width; + Result.cy := CharStruct.Ascent + CharStruct.Descent; + end; +end; + + +procedure TX11Canvas.DoTextOut(const APosition: TPoint; const AText: String); +var + WideText: PWideChar; + AnsiText: string; + Size: Integer; + {$IFDEF XftSupport} + fnt: PXftFont; + fntColor: TXftColor; + s: String16; + + procedure SetXftColor(c: TGfxPixel; var colxft: TXftColor); + begin + colxft.color.blue := (c and $000000FF) shl 8; + colxft.color.green := (c and $0000FF00); + colxft.color.red := (c and $00FF0000) shr 8; + + colxft.color.alpha := (c and $7F000000) shr 15; + colxft.color.alpha := colxft.color.alpha xor $FFFF; // invert: 0 in GfxColor means not translucent + + colxft.pixel := 0; + end; + + {$ENDIF} +begin + if Length(AText) < 1 then + Exit; //==> + + {$IFDEF XftSupport} + fnt := XftFontOpenName(gApplication.Handle, XDefaultScreen(gApplication.Handle), PChar('Sans-12')); + SetXftColor(FCurColor,fntColor); + s := u8(AText); +// XftDrawString8(FXftDraw, fntColor, fnt, APosition.x, Aposition.y, PChar(AText),Length(AText)); + XftDrawString16(FXftDraw, fntColor, fnt, APosition.x, Aposition.y * 3, @s[1], Length16(s)); + XftFontClose(gApplication.Handle, fnt); + {$ELSE} + XDrawString(gApplication.Handle, Handle, GC, APosition.x, + APosition.y + FFontStruct^.ascent, PChar(AText), Length(AText)); + +{ Size := Utf8ToUnicode(nil, PChar(AText), 0); + WideText := GetMem(Size * 2); + Utf8ToUnicode(WideText, PChar(AText), Size); + + XwcDrawText(gApplication.Handle, Handle, GC, APosition.x, + APosition.y + FFontStruct^.ascent, PXwcTextItem(WideText), Length(WideText)); + + FreeMem(WideText); +} + {$ENDIF} +end; + + +procedure TX11Canvas.DoCopyRect(ASource: TFCustomCanvas; const ASourceRect: TRect; + const ADestPos: TPoint); +var + DestPos: TPoint; + RealHeight: Integer; +begin + if not ASource.InheritsFrom(TX11Canvas) then + raise EX11Error.CreateFmt(SIncompatibleCanvasForBlitting, + [ASource.ClassName, Self.ClassName]); + + if (ASource <> Self) and (ASource.PixelFormat.FormatType = ftMono) then + begin + // !!!: This case will probably be removed completely very soon + RealHeight := ASourceRect.Bottom - ASourceRect.Top; + if DestPos.y + RealHeight > Height then + RealHeight := Height - ADestPos.y; + XSetClipMask(gApplication.Handle, GC, TX11Canvas(ASource).Handle); + XSetClipOrigin(gApplication.Handle, GC, ADestPos.x, ADestPos.y); + XFillRectangle(gApplication.Handle, Handle, GC, ADestPos.x, ADestPos.y, + ASource.Width, RealHeight); + // Restore old clipping settings + XSetClipOrigin(gApplication.Handle, GC, 0, 0); + XSetRegion(gApplication.Handle, GC, Region); + end else + XCopyArea(gApplication.Handle, TX11Canvas(ASource).Handle, Handle, GC, + ASourceRect.Left, ASourceRect.Top, + ASourceRect.Right - ASourceRect.Left, + ASourceRect.Bottom - ASourceRect.Top, ADestPos.x, ADestPos.y); +end; + + +procedure TX11Canvas.DoMaskedCopyRect(ASource, AMask: TFCustomCanvas; + const ASourceRect: TRect; const AMaskPos, ADestPos: TPoint); +var + RectWidth, RectHeight: Integer; + DestPos, MaskPos: TPoint; + SourceRect: TRect; +begin + if not ASource.InheritsFrom(TX11Canvas) then + raise EX11Error.CreateFmt(SIncompatibleCanvasForBlitting, + [ASource.ClassName, Self.ClassName]); + if not AMask.InheritsFrom(TX11MonoPixmapCanvas) then + raise EX11Error.CreateFmt(SIncompatibleCanvasForBlitting, + [AMask.ClassName, Self.ClassName]); + + RectWidth := ASourceRect.Right - ASourceRect.Left; + RectHeight := ASourceRect.Bottom - ASourceRect.Top; + + { !!!: Attention! The current implementation only clips to the ClipRect, + i.e. the outer bounds of the current clipping region. In other words, the + result is only correct for a simple rectangle clipping region. } + with DoGetClipRect do + begin + if (ADestPos.x + RectWidth <= Left) or (ADestPos.y + RectHeight <= Top) then + exit; + + DestPos := ADestPos; + MaskPos := AMaskPos; + SourceRect := ASourceRect; + + if DestPos.x < Left then + begin + Inc(MaskPos.x, Left - DestPos.x); + Inc(SourceRect.Left, Left - DestPos.x); + DestPos.x := Left; + end; + if DestPos.y < Top then + begin + Inc(MaskPos.y, Top - DestPos.y); + Inc(SourceRect.Top, Top - DestPos.y); + DestPos.y := Top; + end; + + if (DestPos.x >= Right) or (DestPos.y >= Bottom) then + exit; + + if DestPos.x + RectWidth > Right then + RectWidth := Right - DestPos.x; + if DestPos.y + RectHeight > Bottom then + RectHeight := Bottom - DestPos.y; + end; + + if (RectWidth <= 0) or (RectHeight <= 0) then + exit; + + + XSetClipMask(gApplication.Handle, GC, TX11Canvas(AMask).Handle); + XSetClipOrigin(gApplication.Handle, GC, + DestPos.x - MaskPos.x, DestPos.y - MaskPos.y); + + XCopyArea(gApplication.Handle, TX11Canvas(ASource).Handle, Handle, GC, + SourceRect.Left, SourceRect.Top, RectWidth, RectHeight, + DestPos.x, DestPos.y); + + // Restore old clipping settings + XSetClipOrigin(gApplication.Handle, GC, 0, 0); + XSetRegion(gApplication.Handle, GC, Region); +end; + +procedure TX11Canvas.DoDrawImageRect(AImage: TFCustomImage; ASourceRect: TRect; + const ADestPos: TPoint); +var + Image: XLib.PXImage; + ConvertFormat: TGfxPixelFormat; +begin + ASSERT(AImage.InheritsFrom(TX11Image)); + {$IFDEF Debug} + ASSERT(not TXImage(AImage).IsLocked); + {$ENDIF} + + // !!!: Add support for XF86 4 and XShm etc. to speed this up! + Image := XCreateImage(gApplication.Handle, Visual, + FormatTypeBPPTable[PixelFormat.FormatType], ZPixmap, 0, nil, + ASourceRect.Right - ASourceRect.Left, + ASourceRect.Bottom - ASourceRect.Top, 8, 0); + + { Here its necessary to alloc an extra byte, otherwise it will fail on 32-bits + machines, but still work on 64-bits machines. The cause of this is unknown. } + Image^.data := GetMem(Image^.bytes_per_line * (ASourceRect.Bottom - ASourceRect.Top) + 1); + + if (AImage.PixelFormat.FormatType = ftMono) and + Self.InheritsFrom(TX11MonoPixmapCanvas) then + // mirror the bits within all image data bytes...: + FlipMonoImageBits(ASourceRect, TX11Image(AImage).Data, + TX11Image(AImage).Stride, 0, 0, Image^.data, Image^.bytes_per_line) + else + begin + ConvertFormat := PixelFormat; + { !!!: The following is a workaround: At least the XFree86 X server for + ATI graphics adapters uses 32 bit padding per pixel for 24 bpp + images...?!? To be checked: Is this always the case or only for ATI? } + if ConvertFormat.FormatType = ftRGB24 then + ConvertFormat.FormatType := ftRGB32; + + ConvertImage(ASourceRect, AImage.PixelFormat, AImage.Palette, + TX11Image(AImage).Data, TX11Image(AImage).Stride, + 0, 0, ConvertFormat, Image^.data, Image^.bytes_per_line); + end; + + XPutImage(gApplication.Handle, Handle, GC, + Image, 0, 0, ADestPos.x, ADestPos.y, AImage.Width, AImage.Height); + + FreeMem(Image^.data); + Image^.data := nil; + XDestroyImage(Image); +end; + + +procedure TX11Canvas.Resized(NewWidth, NewHeight: Integer); +var + XRect: TXRectangle; +begin + FWidth := NewWidth; + FHeight := NewHeight; + + XDestroyRegion(Region); + XRect.x := 0; + XRect.y := 0; + XRect.Width := Width; + XRect.Height := Height; + FRegion := XCreateRegion; + XUnionRectWithRegion(@XRect, Region, Region); +end; + + +{ TX11WindowCanvas } + +constructor TX11WindowCanvas.Create(AColormap: TColormap; + AXDrawable: X.TDrawable; ADefaultFont: PXFontStruct); +var + Attr: XLib.TXWindowAttributes; +begin + inherited Create(AColormap, AXDrawable, ADefaultFont); + + XGetWindowAttributes(gApplication.Handle, Handle, @Attr); + FVisual := Attr.Visual; + + case Attr.Depth of + 1: PixelFormat.FormatType := ftMono; + 4: PixelFormat.FormatType := ftPal4; + 8: PixelFormat.FormatType := ftPal8; + 16: PixelFormat.FormatType := ftRGB16; + 24: PixelFormat.FormatType := ftRGB24; + 32: PixelFormat.FormatType := ftRGB32; + else + raise EX11Error.CreateFmt(SWindowUnsupportedPixelFormat, [Attr.Depth]); + end; + + if Attr.Depth >= 16 then + begin + PixelFormat.RedMask := Visual^.red_mask; + PixelFormat.GreenMask := Visual^.green_mask; + PixelFormat.BlueMask := Visual^.blue_mask; + end; +end; + + +{ TX11PixmapCanvas } + +constructor TX11PixmapCanvas.Create(AColormap: TColormap; + AHandle: TPixmap; APixelFormat: TGfxPixelFormat); +begin + inherited Create(AColormap, AHandle, nil); + FPixelFormat := APixelFormat; +end; + + +destructor TX11PixmapCanvas.Destroy; +begin + XFreePixmap(gApplication.Handle, Handle); + inherited Destroy; +end; + +{ TX11MonoPixmapCanvas } + +constructor TX11MonoPixmapCanvas.Create(AColormap: TColormap; AHandle: TPixmap); +begin + inherited Create(AColormap, AHandle, PixelFormatMono); +end; + +{ TX11Image } + +constructor TX11Image.Create(AWidth, AHeight: Integer; APixelFormat: TGfxPixelFormat); +begin + inherited Create(AWidth, AHeight, APixelFormat); + + case APixelFormat.FormatType of + ftMono: + FStride := (AWidth + 7) shr 3; + ftPal4, ftPal4A: + FStride := (AWidth + 1) and not 1; + else + FStride := AWidth * (FormatTypeBPPTable[APixelFormat.FormatType] shr 3); + end; + GetMem(FData, FStride * Height); +end; + +destructor TX11Image.Destroy; +begin + FreeMem(FData); + inherited Destroy; +end; + +procedure TX11Image.Lock(var AData: Pointer; var AStride: LongWord); +begin + ASSERT(not IsLocked); + IsLocked := True; + + AData := Data; + AStride := Stride; +end; + +procedure TX11Image.Unlock; +begin + ASSERT(IsLocked); + IsLocked := False; +end; + + +{ TX11Screen } + +constructor TX11Screen.Create; +begin + inherited Create; + +// FScreenIndex := AScreenIndex; +// FScreenInfo := XScreenOfDisplay(gApplication.Handle, ScreenIndex); +end; + + +{ TX11Application } + +constructor TX11Application.Create; +begin + inherited Create; + + FDirtyList := TDirtyList.Create; +end; + + +destructor TX11Application.Destroy; +var + i: Integer; + WindowListEntry: PXWindowListEntry; +begin + if Assigned(Forms) then + begin + for i := 0 to Forms.Count - 1 do + begin + WindowListEntry := PXWindowListEntry(Forms[i]); + WindowListEntry^.GfxWindow.Free; + Dispose(WindowListEntry); + end; + end; + + DirtyList.Free; + + if Assigned(FDefaultFont) then + begin + if FDefaultFont^.fid <> 0 then + XUnloadFont(Handle, FDefaultFont^.fid); + XFreeFontInfo(nil, FDefaultFont, 0); + end; + + if Assigned(Handle) then + XCloseDisplay(Handle); + + inherited Destroy; +end; + +procedure TX11Application.AddWindow(AWindow: TFCustomWindow); +var + WindowListEntry: PXWindowListEntry; +begin + New(WindowListEntry); + WindowListEntry^.GfxWindow := AWindow; + WindowListEntry^.XWindowID := AWindow.Handle; + Forms.Add(WindowListEntry); +end; + +procedure TX11Application.Run; +var + Event: TXEvent; + WindowListEntry: PXWindowListEntry; +begin + DoBreakRun := False; + + while (not (QuitWhenLastWindowCloses and (Forms.Count = 0))) and + (DoBreakRun = False) do + begin + if Assigned(OnIdle) or Assigned(DirtyList.First) then + begin + if not XCheckMaskEvent(Handle, MaxInt, @Event) then + begin + if Assigned(DirtyList.First) then DirtyList.PaintAll + else if Assigned(OnIdle) then OnIdle(Self); + + continue; + end; + end + else + XNextEvent(Handle, @Event); + + // if the event filter returns true then it ate the message + if Assigned(FEventFilter) and FEventFilter(Event) then continue; + + if Forms.Count = 0 then continue; + + // According to a comment in X.h, the valid event types start with 2! + if Event._type >= 2 then + begin + WindowListEntry := FindWindowByXID(Event.XAny.Window); + + if Event._type = X.DestroyNotify then + begin + Forms.Remove(WindowListEntry); + Dispose(WindowListEntry); + end + else if Assigned(WindowListEntry) then + begin + if Assigned(WindowListEntry^.GfxWindow) then + WindowListEntry^.GfxWindow.Dispatch(Event); + end + else + WriteLn('fpGFX/X11: Received X event "', GetXEventName(Event._type), + '" for unknown window'); + end; + end; + DoBreakRun := False; +end; + + +procedure TX11Application.Quit; +begin + DoBreakRun := True; +end; + + +function TX11Application.FindWindowByXID(XWindowID: X.TWindow): PXWindowListEntry; +var + i: Integer; +begin + for i := 0 to Forms.Count - 1 do + begin + Result := PXWindowListEntry(Forms[i]); + if Result^.XWindowID = XWindowID then + exit; + end; + Result := nil; +end; + +procedure TX11Application.Initialize(ADisplayName: String = ''); +begin + if Length(ADisplayName) = 0 then FDisplayName := XDisplayName(nil) + else FDisplayName := ADisplayName; + + Handle := XOpenDisplay(PChar(DisplayName)); + + if not Assigned(Handle) then + raise EX11Error.CreateFmt(SOpenDisplayFailed, [DisplayName]); + + FDefaultFont := XLoadQueryFont(Handle, + '-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-iso8859-1'); + + if not Assigned(FDefaultFont) then + begin + FDefaultFont := XLoadQueryFont(Handle, 'fixed'); + if not Assigned(FDefaultFont) then + raise EX11Error.Create(SNoDefaultFont); + end; +end; + +{ TX11Window } + +{ Note, this only creates a window, it doesn't actually show the window. It + is still invisible. To make it visible, we need to call Show(). } +constructor TX11Window.Create(AParent: TFCustomWindow; + AWindowOptions: TGfxWindowOptions); +const + WindowHints: TXWMHints = ( + flags: InputHint or StateHint or WindowGroupHint; + input: True; + initial_state: NormalState; + icon_pixmap: 0; + icon_window: 0; + icon_x: 0; + icon_y: 0; + icon_mask: 0; + window_group: 0; + ); +var + Colormap: TColormap; + Attr: TXSetWindowAttributes; + SizeHints: TXSizeHints; + ClassHint: PXClassHint; + lParentHandle: X.TWindow; + mask: longword; +begin + inherited Create; + + WindowOptions := AWindowOptions; + FParent := AParent; + + + if (woX11SkipWMHints in WindowOptions) = False then + begin + if LeaderWindow = 0 then + begin + LeaderWindow := XCreateSimpleWindow(gApplication.Handle, + XDefaultRootWindow(gApplication.Handle), 10, 10, 10, 10, 0, 0, 0); + + ClassHint := XAllocClassHint; + ClassHint^.res_name := 'fpGFX'; // !!! use app name + ClassHint^.res_class := 'FpGFX'; + XSetWMProperties(gApplication.Handle, LeaderWindow, nil, nil, nil, 0, nil, nil, + ClassHint); + XFree(ClassHint); + ClientLeaderAtom := XInternAtom(gApplication.Handle, 'WM_CLIENT_LEADER', False); + end; + end; + + Colormap := XDefaultColormap(gApplication.Handle, XDefaultScreen(gApplication.Handle)); + Attr.Colormap := Colormap; + + SizeHints.flags := XUtil.PSize; + SizeHints.x := 0; + SizeHints.y := 0; + SizeHints.width := 200; + SizeHints.height := 200; + + { Make sure we use the correct parent handle } + if FParent <> nil then + lParentHandle := TX11Window(FParent).Handle + else + lParentHandle := XDefaultRootWindow(gApplication.Handle); + + { setup attributes and masks } + if (woBorderless in WindowOptions) or (woToolWindow in WindowOptions) or + (woPopup in WindowOptions) then + begin + Attr.Override_Redirect := longbool(1); // this removes window borders + mask := CWOverrideRedirect or CWColormap; + end + else + begin + Attr.Override_Redirect := longbool(0); + mask := CWColormap; + end; + + FHandle := CreateXWindow( + lParentHandle, // parent + SizeHints.x, SizeHints.x, // position (top, left) + SizeHints.width, SizeHints.height, // default size + XDefaultVisual(gApplication.Handle, XDefaultScreen(gApplication.Handle)), // visual + mask, + Attr); + + if FHandle = 0 then + raise EX11Error.Create(SWindowCreationFailed); + + XSelectInput(gApplication.Handle, FHandle, KeyPressMask or KeyReleaseMask + or ButtonPressMask or ButtonReleaseMask or EnterWindowMask + or LeaveWindowMask or PointerMotionMask or ExposureMask or FocusChangeMask + or StructureNotifyMask); + + if (woX11SkipWMHints in WindowOptions) = False then + begin + XSetStandardProperties(gApplication.Handle, Handle, nil, nil, 0, + argv, argc, @SizeHints); + + XSetWMNormalHints(gApplication.Handle, Handle, @SizeHints); + + WindowHints.flags := WindowGroupHint; + WindowHints.window_group := LeaderWindow; + XSetWMHints(gApplication.Handle, Handle, @WindowHints); + + XChangeProperty(gApplication.Handle, Handle, ClientLeaderAtom, 33, 32, + PropModeReplace, @LeaderWindow, 1); + + // We want to get a Client Message when the user tries to close this window + if gApplication.FWMProtocols = 0 then + gApplication.FWMProtocols := XInternAtom(gApplication.Handle, 'WM_PROTOCOLS', False); + if gApplication.FWMDeleteWindow = 0 then + gApplication.FWMDeleteWindow := XInternAtom(gApplication.Handle, 'WM_DELETE_WINDOW', False); + + // send close event instead of quitting the whole application... + XSetWMProtocols(gApplication.Handle, FHandle, @gApplication.FWMDeleteWindow, 1); + end; + + FCanvas := TX11WindowCanvas.Create(Colormap, Handle, gApplication.FDefaultFont); +end; + + +destructor TX11Window.Destroy; +begin + if Assigned(OnClose) then + OnClose(Self); + + gApplication.DirtyList.ClearQueueForWindow(Self); + + XDestroyWindow(gApplication.Handle, Handle); + Canvas.Free; + + gApplication.FindWindowByXID(Handle)^.GfxWindow := nil; + + if FCurCursorHandle <> 0 then + XFreeCursor(gApplication.Handle, FCurCursorHandle); + + inherited Destroy; +end; + + +procedure TX11Window.DefaultHandler(var Message); +begin + WriteLn('fpGFX/X11: Unhandled X11 event received: ', + GetXEventName(TXEvent(Message)._type)); +end; + + +procedure TX11Window.SetPosition(const APosition: TPoint); +var + Supplied: PtrInt; + SizeHints: PXSizeHints; +begin + SizeHints := XAllocSizeHints; + XGetWMNormalHints(gApplication.Handle, Handle, SizeHints, @Supplied); + SizeHints^.flags := SizeHints^.flags or PPosition; + SizeHints^.x := APosition.x; + SizeHints^.y := APosition.y; + XSetWMNormalHints(gApplication.Handle, Handle, SizeHints); + XFree(SizeHints); + XMoveWindow(gApplication.Handle, Handle, APosition.x, APosition.y); +end; + + +procedure TX11Window.SetSize(const ASize: TSize); +begin + // !!!: Implement this properly + WriteLn('fpGFX/X11: TXWindow.SetSize is not properly implemented yet'); + SetClientSize(ASize); +end; + + +procedure TX11Window.SetMinMaxSize(const AMinSize, AMaxSize: TSize); +begin + // !!!: Implement this properly + WriteLn('fpGFX/X11: TXWindow.SetMinMaxSize is not properly implemented yet'); + SetMinMaxClientSize(AMinSize, AMaxSize); +end; + + +procedure TX11Window.SetClientSize(const ASize: TSize); +var + ChangeMask: Cardinal; + Changes: TXWindowChanges; +begin + ChangeMask := 0; + + if ASize.cx <> ClientWidth then + begin + ChangeMask := CWWidth; + Changes.Width := ASize.cx; + end; + + if ASize.cy <> ClientHeight then + begin + ChangeMask := ChangeMask or CWHeight; + Changes.Height := ASize.cy; + end; + + if ChangeMask <> 0 then + XConfigureWindow(gApplication.Handle, Handle, ChangeMask, @Changes); +end; + + +procedure TX11Window.SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); +var + Supplied: PtrInt; + SizeHints: PXSizeHints; +begin + CanMaximize := (AMaxSize.cx = 0) or (AMaxSize.cy = 0) or + (AMaxSize.cx > AMinSize.cx) or (AMaxSize.cy > AMinSize.cy); + UpdateMotifWMHints; + + SizeHints := XAllocSizeHints; + XGetWMNormalHints(gApplication.Handle, Handle, SizeHints, @Supplied); + with SizeHints^ do + begin + if (AMinSize.cx > 0) or (AMinSize.cy > 0) then + begin + flags := flags or PMinSize; + min_width := AMinSize.cx; + min_height := AMinSize.cy; + end else + flags := flags and not PMinSize; + + if (AMaxSize.cx > 0) or (AMaxSize.cy > 0) then + begin + flags := flags or PMaxSize; + if AMaxSize.cx > 0 then + max_width := AMaxSize.cx + else + max_width := 32767; + if AMaxSize.cy > 0 then + max_height := AMaxSize.cy + else + max_height := 32767; + end else + flags := flags and not PMaxSize; + end; + + XSetWMNormalHints(gApplication.Handle, Handle, SizeHints); + XFree(SizeHints); +end; + + +{ Makes the window visible and raises it to the top of the stack. } +procedure TX11Window.Show; +begin + XMapRaised(gApplication.Handle, Handle); +end; + + +procedure TX11Window.Invalidate(const ARect: TRect); +begin + gApplication.DirtyList.AddRect(Self, ARect); +end; + + +procedure TX11Window.PaintInvalidRegion; +begin + gApplication.DirtyList.PaintQueueForWindow(Self); +end; + + +procedure TX11Window.CaptureMouse; +begin + XGrabPointer(gApplication.Handle, Handle, False, ButtonPressMask or + ButtonReleaseMask or EnterWindowMask or LeaveWindowMask or + PointerMotionMask, GrabModeAsync, GrabModeAsync, 0, 0, CurrentTime); +end; + + +procedure TX11Window.ReleaseMouse; +begin + XUngrabPointer(gApplication.Handle, CurrentTime); +end; + + +// protected methods + +function TX11Window.GetTitle: String; +var + s: PChar; +begin + XFetchName(gApplication.Handle, Handle, @s); + Result := s; + XFree(s); +end; + + +procedure TX11Window.SetTitle(const ATitle: String); +begin + XStoreName(gApplication.Handle, Handle, PChar(ATitle)); +end; + + +procedure TX11Window.DoSetCursor; +const + CursorTable: array[TGfxCursor] of Integer = ( + -1, // crDefault + -2, // crNone !!!: not implemented + -1, // crArrow + 34, // crCross + 152, // crIBeam + 52, // crSize + 116, // crSizeNS + 108, // crSizeWE + 114, // crUpArrow + 150, // crHourGlass + 0, // crNoDrop + 92); // crHelp +var + ID: Integer; +begin + if FCurCursorHandle <> 0 then + XFreeCursor(gApplication.Handle, FCurCursorHandle); + ID := CursorTable[Cursor]; + if ID = -1 then + FCurCursorHandle := 0 + else + FCurCursorHandle := XCreateFontCursor(gApplication.Handle, ID); + XDefineCursor(gApplication.Handle, Handle, FCurCursorHandle); +end; + + +function TX11Window.ConvertShiftState(AState: Cardinal): TShiftState; +begin + Result := []; + if (AState and Button1Mask) <> 0 then + Include(Result, ssLeft); + if (AState and Button2Mask) <> 0 then + Include(Result, ssMiddle); + if (AState and Button3Mask) <> 0 then + Include(Result, ssRight); + if (AState and ShiftMask) <> 0 then + Include(Result, ssShift); + if (AState and LockMask) <> 0 then + Include(Result, ssCaps); + if (AState and ControlMask) <> 0 then + Include(Result, ssCtrl); + if (AState and Mod1Mask) <> 0 then + Include(Result, ssAlt); + if (AState and Mod2Mask) <> 0 then + Include(Result, ssNum); + if (AState and Mod4Mask) <> 0 then + Include(Result, ssSuper); + if (AState and Mod5Mask) <> 0 then + Include(Result, ssScroll); + if (AState and (1 shl 13)) <> 0 then + Include(Result, ssAltGr); +end; + +function TX11Window.KeySymToKeycode(KeySym: TKeySym): Word; +const + Table_20aX: array[$20a0..$20ac] of Word = (keyEcuSign, keyColonSign, + keyCruzeiroSign, keyFFrancSign, keyLiraSign, keyMillSign, keyNairaSign, + keyPesetaSign, keyRupeeSign, keyWonSign, keyNewSheqelSign, keyDongSign, + keyEuroSign); + Table_feXX: array[$fe50..$fe60] of Word = (keyDeadGrave, keyDeadAcute, + keyDeadCircumflex, keyDeadTilde, keyDeadMacron,keyDeadBreve, + keyDeadAbovedot, keyDeadDiaeresis, keyDeadRing, keyDeadDoubleacute, + keyDeadCaron, keyDeadCedilla, keyDeadOgonek, keyDeadIota, + keyDeadVoicedSound, keyDeadSemivoicedSound, keyDeadBelowdot); + Table_ff5X: array[$ff50..$ff58] of Word = (keyHome, keyLeft, keyUp, keyRight, + keyDown, keyPrior, keyNext, keyEnd, keyBegin); + Table_ff6X: array[$ff60..$ff6b] of Word = (keySelect, keyPrintScreen, + keyExecute, keyNIL, keyInsert, keyUndo, keyRedo, keyMenu, keyFind, + keyCancel, keyHelp, keyBreak); + Table_ff9X: array[$ff91..$ff9f] of Word = (keyPF1, keyPF2, keyPF3, keyPF4, + keyP7, keyP4, keyP8, keyP6, keyP2, keyP9, keyP3, keyP1, keyP5, keyP0, + keyPDecimal); + Table_ffeX: array[$ffe1..$ffee] of Word = (keyShiftL, keyShiftR, keyCtrlL, + keyCtrlR, keyCapsLock, keyShiftLock, keyMetaL, keyMetaR, keyAltL, keyAltR, + keySuperL, keySuperR, keyHyperL, keyHyperR); +begin + case KeySym of + 0..Ord('a')-1, Ord('z')+1..$bf, $f7: + Result := KeySym; + Ord('a')..Ord('z'), $c0..$f6, $f8..$ff: + Result := KeySym - 32; + $20a0..$20ac: Result := Table_20aX[KeySym]; + $fe20: Result := keyTab; + $fe50..$fe60: Result := Table_feXX[KeySym]; + $ff08: Result := keyBackspace; + $ff09: Result := keyTab; + $ff0a: Result := keyLinefeed; + $ff0b: Result := keyClear; + $ff0d: Result := keyReturn; + $ff13: Result := keyPause; + $ff14: Result := keyScrollLock; + $ff15: Result := keySysRq; + $ff1b: Result := keyEscape; + $ff50..$ff58: Result := Table_ff5X[KeySym]; + $ff60..$ff6b: Result := Table_ff6X[KeySym]; + $ff7e: Result := keyModeSwitch; + $ff7f: Result := keyNumLock; + $ff80: Result := keyPSpace; + $ff89: Result := keyPTab; + $ff8d: Result := keyPEnter; + $ff91..$ff9f: Result := Table_ff9X[KeySym]; + $ffaa: Result := keyPAsterisk; + $ffab: Result := keyPPlus; + $ffac: Result := keyPSeparator; + $ffad: Result := keyPMinus; + $ffae: Result := keyPDecimal; + $ffaf: Result := keyPSlash; + $ffb0..$ffb9: Result := keyP0 + KeySym - $ffb0; + $ffbd: Result := keyPEqual; + $ffbe..$ffe0: Result := keyF1 + KeySym - $ffbe; + $ffe1..$ffee: Result := Table_ffeX[KeySym]; + $ffff: Result := keyDelete; + else + Result := keyNIL; + end; +{$IFDEF Debug} + if Result = keyNIL then + WriteLn('fpGFX/X11: Unknown KeySym: $', IntToHex(KeySym, 4)); +{$ENDIF} +end; + + +procedure TX11Window.UpdateMotifWMHints; +type + PMotifWmHints = ^TMotifWmHints; + TMotifWmHints = packed record + Flags, Functions, Decorations: LongWord; + InputMode: LongInt; + Status: LongWord; + end; +const + MWM_HINTS_FUNCTIONS = 1; + MWM_HINTS_DECORATIONS = 2; + FuncAll = 1; + FuncResize = 2; + FuncMove = 4; + FuncMinimize = 8; + FuncMaximize = 16; + FuncClose = 32; + DecorAll = 1; + DecorBorder = 2; + DecorResizeH = 4; + DecorTitle = 8; + DecorMenu = 16; + DecorMinimize = 32; + DecorMaximize = 64; +var + PropType: TAtom; + PropFormat: LongInt; + PropItemCount, PropBytesAfter: LongWord; + Hints: PMotifWmHints; + NewHints: TMotifWmHints; +begin + if gApplication.FWMHints = 0 then + gApplication.FWMHints := + XInternAtom(gApplication.Handle, '_MOTIF_WM_HINTS', False); + + XGetWindowProperty(gApplication.Handle, Handle, + gApplication.FWMHints, 0, 5, False, AnyPropertyType, @PropType, + @PropFormat, @PropItemCount, @PropBytesAfter, @Hints); + + NewHints.Flags := MWM_HINTS_FUNCTIONS or MWM_HINTS_DECORATIONS; + NewHints.Functions := FuncResize or FuncMove or FuncMinimize or FuncClose; + + if (woToolWindow in WindowOptions) or (woWindow in WindowOptions) or + (woPopup in WindowOptions) then + NewHints.Decorations := DecorBorder or DecorTitle or DecorMenu or DecorMinimize + else + NewHints.Decorations := 0; + if CanMaximize then + begin + NewHints.Functions := NewHints.Functions or FuncMaximize; + NewHints.Decorations := NewHints.Decorations or DecorMaximize; + end; + + if Assigned(Hints) then + begin + Hints^.Flags := Hints^.Flags or NewHints.Flags; + Hints^.Decorations := NewHints.Decorations; + Hints^.Functions := NewHints.Functions; + end else + Hints := @NewHints; + + XChangeProperty(gApplication.Handle, Handle, + gApplication.FWMHints, gApplication.FWMHints, + 32, PropModeReplace, Pointer(Hints), 5); + if Hints <> @NewHints then + XFree(Hints); +end; + + +// private methods + +const + ButtonTable: array[1..3] of TMouseButton = (mbLeft, mbMiddle, mbRight); + + +function TX11Window.StartComposing(const Event: TXKeyEvent): TKeySym; +begin + SetLength(FComposeBuffer, + XLookupString(@Event, @FComposeBuffer[1], + SizeOf(FComposeBuffer) - 1, @Result, @FComposeStatus)); +end; + + +procedure TX11Window.EndComposing; +var + i: Integer; +begin + if Assigned(OnKeyChar) then + for i := 1 to Length(FComposeBuffer) do + OnKeyChar(Self, FComposeBuffer[i]); +end; + + +procedure TX11Window.KeyPressed(var Event: TXKeyPressedEvent); +var + KeySym: TKeySym; +begin + KeySym := StartComposing(Event); + if Assigned(OnKeyPressed) then + OnKeyPressed(Self, KeySymToKeycode(KeySym), ConvertShiftState(Event.State)); + + if (Event.State and (ControlMask or Mod1Mask)) = 0 then + EndComposing; +end; + + +procedure TX11Window.KeyReleased(var Event: TXKeyReleasedEvent); +var + KeySym: TKeySym; +begin + KeySym := StartComposing(Event); + if Assigned(OnKeyReleased) then + OnKeyReleased(Self, KeySymToKeycode(KeySym), + ConvertShiftState(Event.State)); + // Do not call EndComposing, as this would generate duplicate KeyChar events! +end; + + +procedure TX11Window.ButtonPressed(var Event: TXButtonPressedEvent); +var + Sum: Integer; + NewEvent: TXEvent; +begin + case Event.Button of + Button1..Button3: + if Assigned(OnMousePressed) then + OnMousePressed(Self, ButtonTable[Event.Button], + ConvertShiftState(Event.State), Point(Event.x, Event.y)); + Button4, Button5: // Mouse wheel message + begin + if Event.Button = Button4 then + Sum := -1 + else + Sum := 1; + + // Check for other mouse wheel messages in the queue + while XCheckTypedWindowEvent(gApplication.Handle, Handle, + X.ButtonPress, @NewEvent) do + begin + if NewEvent.xbutton.Button = 4 then + Dec(Sum) + else if NewEvent.xbutton.Button = 5 then + Inc(Sum) + else + begin + XPutBackEvent(gApplication.Handle, @NewEvent); + break; + end; + end; + + if Assigned(OnMouseWheel) then + OnMouseWheel(Self, ConvertShiftState(Event.State), + Sum, Point(Event.x, Event.y)); + end; + end; +end; + + +procedure TX11Window.ButtonReleased(var Event: TXButtonReleasedEvent); +begin + if (Event.Button >= 1) and (Event.Button <= 3) and + Assigned(OnMouseReleased) then + OnMouseReleased(Self, ButtonTable[Event.Button], + ConvertShiftState(Event.State), Point(Event.x, Event.y)); +end; + + +procedure TX11Window.EnterWindow(var Event: TXEnterWindowEvent); +begin + if Assigned(OnMouseEnter) then + OnMouseEnter(Self, ConvertShiftState(Event.State), Point(Event.x, Event.y)); +end; + + +procedure TX11Window.LeaveWindow(var Event: TXLeaveWindowEvent); +begin + if Assigned(OnMouseEnter) then + OnMouseLeave(Self); +end; + + +procedure TX11Window.PointerMoved(var Event: TXPointerMovedEvent); +begin + if Assigned(OnMouseMove) then + OnMouseMove(Self, ConvertShiftState(Event.State), Point(Event.x, Event.y)); +end; + + +procedure TX11Window.Expose(var Event: TXExposeEvent); +{var + IsNotEmpty: Boolean; +begin +WriteLn('Expose'); + if Assigned(OnPaint) then + with Event do + begin + if not IsExposing then + begin + IsExposing := True; + Canvas.SaveState; + Canvas.EmptyClipRect; + end; + IsNotEmpty := Canvas.UnionClipRect(Rect(x, y, x + Width, y + Height)); + if Count = 0 then + begin + if IsNotEmpty then + OnPaint(Self, Canvas.GetClipRect); + IsExposing := False; + Canvas.RestoreState; + end; + end; +end;} +var + r: TRect; +begin + with Event do + r := Rect(x, y, x + Width, y + Height); + gApplication.DirtyList.AddRect(Self, r); +end; + + +procedure TX11Window.FocusIn(var Event: TXFocusInEvent); +begin + if Assigned(OnFocusIn) then + OnFocusIn(Self); +end; + + +procedure TX11Window.FocusOut(var Event: TXFocusOutEvent); +begin + if Assigned(OnFocusOut) then + OnFocusOut(Self); +end; + + +procedure TX11Window.Map(var Event: TXMapEvent); +begin + if Assigned(OnShow) then + OnShow(Self); +end; + + +procedure TX11Window.Unmap(var Event: TXUnmapEvent); +begin + if Assigned(OnHide) then + OnHide(Self); +end; + + +procedure TX11Window.Reparent(var Event: TXReparentEvent); +begin + if Assigned(OnCreate) then + OnCreate(Self); +end; + + +procedure TX11Window.Configure(var Event: TXConfigureEvent); +begin + while XCheckTypedWindowEvent(gApplication.Handle, Handle, + X.ConfigureNotify, @Event) do; + + if (Event.x <> Left) or (Event.y <> Top) then + begin + FLeft := Event.x; + FTop := Event.y; + if Assigned(OnMove) then + OnMove(Self); + end; + if (Event.Width <> Width) or (Event.Height <> Height) then + begin + // !!!: The following 2 lines are _quite_ wrong... :) + FWidth := Event.Width; + FHeight := Event.Height; + FClientWidth := Event.Width; + FClientHeight := Event.Height; + TX11Canvas(Canvas).Resized(ClientWidth, ClientHeight); + if Assigned(OnResize) then + OnResize(Self); + end; +end; + + +procedure TX11Window.ClientMessage(var Event: TXClientMessageEvent); +begin + if Event.message_type = gApplication.FWMProtocols then + if Event.Data.l[0] = gApplication.FWMDeleteWindow then + begin + if CanClose then + Free; + end else + WriteLn('fpGFX/X11: Unknown client protocol message: ', Event.Data.l[0]) + else + WriteLn('fpGFX/X11: Unknown client message: ', Event.message_type); +end; + +function TX11Window.CreateXWindow(AParent: X.TWindow; ALeft, ATop: longint; AWidth, AHeight: longword; + AVisual: PVisual; AValueMask: LongWord; const AAttr: TXSetWindowAttributes): X.TWindow; +begin + Result := XCreateWindow( + gApplication.Handle, + AParent, // parent + ALeft, ATop, // position (top, left) + AWidth, AHeight, // size (width, height) + 0, // border size + CopyFromParent, // depth + InputOutput, // class + AVisual, // visual + AValueMask, + @AAttr); +end; + + +{ Global utility functions } + +function RectToXRect(const ARect: TRect): TXRectangle; +begin + Result.x := ARect.Left; + Result.y := ARect.Top; + Result.width := ARect.Right - ARect.Left; + Result.height := ARect.Bottom - ARect.Top; +end; + + +function XRectToRect(const ARect: TXRectangle): TRect; +begin + Result.Left := ARect.x; + Result.Top := ARect.y; + Result.Right := ARect.x + ARect.width; + Result.Bottom := ARect.y + ARect.height; +end; + + +function GetXEventName(Event: LongInt): String; +const + EventNames: array[2..34] of String = ( + 'KeyPress', 'KeyRelease', 'ButtonPress', 'ButtonRelease', 'MotionNotify', + 'EnterNotify', 'LeaveNotify', 'FocusIn', 'FocusOut', 'KeymapNotify', + 'Expose', 'GraphicsExpose', 'NoExpose', 'VisibilityNotify', 'CreateNotify', + 'DestroyNotify', 'UnmapNotify', 'MapNotify', 'MapRequest', 'ReparentNotify', + 'ConfigureNotify', 'ConfigureRequest', 'GravityNotify', 'ResizeRequest', + 'CirculateNotify', 'CirculateRequest', 'PropertyNotify', 'SelectionClear', + 'SelectionRequest', 'SelectionNotify', 'ColormapNotify', 'ClientMessage', + 'MappingNotify'); +begin + if (Event >= Low(EventNames)) and (Event <= High(EventNames)) then + Result := EventNames[Event] + else + Result := '#' + IntToStr(Event); +end; + +end. + + diff --git a/gfx/x11/gfxinterface.pas b/gfx/x11/gfxinterface.pas new file mode 100644 index 00000000..248c935f --- /dev/null +++ b/gfx/x11/gfxinterface.pas @@ -0,0 +1,41 @@ +{ + fpGUI - Free Pascal Graphical User Interface + + GFXInterface - Default target selection unit for X11 target + + Copyright (C) 2000 - 2006 See the file AUTHORS, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + 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. +} +unit gfxinterface; + +interface + +uses + GFX_X11; + +type + + TDefCanvas = TX11Canvas; + + TDefFont = TX11Font; + + TDefScreen = TX11Screen; + + TDefApplication = TX11Application; + + TDefWindow = TX11Window; + + TDefImage = TX11Image; + + +implementation + +end. + diff --git a/gfx/x11/unitxft.pas b/gfx/x11/unitxft.pas new file mode 100644 index 00000000..2ede5a10 --- /dev/null +++ b/gfx/x11/unitxft.pas @@ -0,0 +1,155 @@ +{ + fpGFX - Free Pascal Graphics Library + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGFX development team. + + Xft interface functions + + See the file COPYING.fpGFX, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +unit unitxft; + +{$mode objfpc}{$H+} + +{$linklib Xft} + +interface +uses + Classes + ,SysUtils + ,X + ,XLib + ,Xutil + ; + + +type + TPicture = longword; + + TXftDraw = record + dummy : Pointer; + end; + PXftDraw = ^TXftDraw; + + TXftFont = record + ascent : integer; + descent : integer; + height : integer; + max_advance_width : integer; + ptr1 : Pointer; // charset + ptr2 : Pointer; // pattern + end; + PXftFont = ^TXftFont; + + TXRenderColor = record + red : word; + green : word; + blue : word; + alpha : word; + end; + + TXftColor = record + pixel : longword; + color : TXRenderColor; + end; + + TXGlyphInfo = packed record + width : word; + height : word; + x : smallint; + y : smallint; + xOff : smallint; + yOff : smallint; + end; + + TFcPattern = record + dummy : integer; + end; + + PFcPattern = ^TFcPattern; + PPFcPattern = ^PFcPattern; + + TFcFontSet = packed record + nfont : integer; + sfont : integer; + fonts : PPFcPattern; + end; + PFcFontSet = ^TFcFontSet; + +const + FC_FAMILY : PChar = 'family'; + FC_SIZE : PChar = 'size'; + FC_SCALABLE : PChar = 'scalable'; + + FcTypeVoid = 0; + FcTypeInteger = 1; + FcTypeDouble = 2; + FcTypeString = 3; + FcTypeBool = 4; + FcTypeMatrix = 5; + FcTypeCharSet = 6; + FcTypeFTFace = 7; + FcTypeLangSet = 8; + +function XftDrawCreate(display : PXDisplay; win : TXID; vis : PVisual; colorm : longint) : PXftDraw; cdecl; +procedure XftDrawChange(xftd : PXftDraw; win : TXID); cdecl; +procedure XftDrawDestroy(draw : PXftDraw); cdecl; + +function XftDrawPicture(draw : PXftDraw) : TPicture; cdecl; + +function XftFontOpenName(display : PXDisplay; scr : integer; par3 : PChar) : PXftFont; cdecl; +procedure XftFontClose(display : PXDisplay; fnt : PXftFont); cdecl; + +procedure XftDrawString8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; +procedure XftDrawString16(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; + +procedure XftTextExtents16(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; +procedure XftTextExtents8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; + +//function XftGlyphExists(display : PXDisplay; fnt : PXftFont; ch : integer) : longbool; cdecl; + +//procedure XftDrawSetClipRectangles(draw : PXftDraw; xorigin, yorigin : integer; rect : PXRectangle; rnum : integer); cdecl; + +procedure XftDrawSetClip(draw : PXftDraw; rg : TRegion); cdecl; + +function XftListFonts(display : PXDisplay; screen : integer; params : array of const) : PFcFontSet; cdecl; +function XftNameUnparse(pat : PFcPattern; dest : PChar; destlen : integer) : boolean; cdecl; +procedure FcFontSetDestroy(fsp : PFcFontSet); cdecl; + +implementation + +function XftDrawCreate(display : PXDisplay; win : TXID; vis : PVisual; colorm : longint) : PXftDraw; cdecl; external; +procedure XftDrawChange(xftd : PXftDraw; win : TXID); cdecl; external; +procedure XftDrawDestroy(draw : PXftDraw); cdecl; external; + +function XftDrawPicture(draw : PXftDraw) : TPicture; cdecl; external; + +function XftFontOpenName(display : PXDisplay; scr : integer; par3 : PChar) : PXftFont; cdecl; external; +procedure XftFontClose(display : PXDisplay; fnt : PXftFont); cdecl; external; + +procedure XftDrawString8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external; +procedure XftDrawString16(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external; + +procedure XftTextExtents16(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external; +procedure XftTextExtents8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external; + +//function XftGlyphExists(display : PXDisplay; fnt : PXftFont; ch : integer) : longbool; cdecl; external; + +//procedure XftDrawSetClipRectangles(draw : PXftDraw; xorigin, yorigin : integer; rect : PXRectangle; rnum : integer); cdecl; external; + +procedure XftDrawSetClip(draw : PXftDraw; rg : TRegion); cdecl; external; + +function XftListFonts(display : PXDisplay; screen : integer; params : array of const) : PFcFontSet; cdecl; external; +function XftNameUnparse(pat : PFcPattern; dest : PChar; destlen : integer) : boolean; cdecl; external; +procedure FcFontSetDestroy(fsp : PFcFontSet); cdecl; external; + +end. + diff --git a/gui/Makefile b/gui/Makefile new file mode 100644 index 00000000..8fbc78c3 --- /dev/null +++ b/gui/Makefile @@ -0,0 +1,2014 @@ +# +# Don't edit, this file is generated by FPCMake Version 2.0.0 [2006/08/31] +# +default: all +MAKEFILETARGETS=i386-linux +BSDs = freebsd netbsd openbsd darwin +UNIXs = linux $(BSDs) solaris qnx +LIMIT83fs = go32v2 os2 emx watcom +FORCE: +.PHONY: FORCE +override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH))) +ifneq ($(findstring darwin,$(OSTYPE)),) +inUnix=1 #darwin +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +ifeq ($(findstring ;,$(PATH)),) +inUnix=1 +SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH))) +else +SEARCHPATH:=$(subst ;, ,$(PATH)) +endif +endif +SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE)))) +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH)))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH)))) +ifeq ($(PWD),) +$(error You need the GNU utils package to use this Makefile) +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT= +endif +else +PWD:=$(firstword $(PWD)) +SRCEXEEXT=.exe +endif +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +else +ifneq ($(findstring cygdrive,$(PATH)),) +inCygWin=1 +endif +endif +ifdef inUnix +SRCBATCHEXT=.sh +else +ifdef inOS2 +SRCBATCHEXT=.cmd +else +SRCBATCHEXT=.bat +endif +endif +ifdef inUnix +PATHSEP=/ +else +PATHSEP:=$(subst /,\,/) +ifdef inCygWin +PATHSEP=/ +endif +endif +ifdef PWD +BASEDIR:=$(subst \,/,$(shell $(PWD))) +ifdef inCygWin +ifneq ($(findstring /cygdrive/,$(BASEDIR)),) +BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR)) +BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR))) +BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR)) +endif +endif +else +BASEDIR=. +endif +ifdef inOS2 +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO=echo +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +endif +override DEFAULT_FPCDIR=/opt/fpc/src +ifndef FPC +ifdef PP +FPC=$(PP) +endif +endif +ifndef FPC +FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(FPCPROG),) +FPCPROG:=$(firstword $(FPCPROG)) +FPC:=$(shell $(FPCPROG) -PB) +ifneq ($(findstring Error,$(FPC)),) +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +else +override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH))))) +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) +FOUNDFPC:=$(strip $(wildcard $(FPC))) +ifeq ($(FOUNDFPC),) +FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))) +ifeq ($(FOUNDFPC),) +$(error Compiler $(FPC) not found) +endif +endif +ifndef FPC_COMPILERINFO +FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO) +endif +ifndef FPC_VERSION +FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO)) +endif +export FPC FPC_VERSION FPC_COMPILERINFO +unexport CHECKDEPEND ALLDEPENDENCIES +ifndef CPU_TARGET +ifdef CPU_TARGET_DEFAULT +CPU_TARGET=$(CPU_TARGET_DEFAULT) +endif +endif +ifndef OS_TARGET +ifdef OS_TARGET_DEFAULT +OS_TARGET=$(OS_TARGET_DEFAULT) +endif +endif +ifneq ($(words $(FPC_COMPILERINFO)),5) +FPC_COMPILERINFO+=$(shell $(FPC) -iSP) +FPC_COMPILERINFO+=$(shell $(FPC) -iTP) +FPC_COMPILERINFO+=$(shell $(FPC) -iSO) +FPC_COMPILERINFO+=$(shell $(FPC) -iTO) +endif +ifndef CPU_SOURCE +CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO)) +endif +ifndef CPU_TARGET +CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO)) +endif +ifndef OS_SOURCE +OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO)) +endif +ifndef OS_TARGET +OS_TARGET:=$(word 5,$(FPC_COMPILERINFO)) +endif +FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +TARGETSUFFIX=$(OS_TARGET) +SOURCESUFFIX=$(OS_SOURCE) +else +TARGETSUFFIX=$(FULL_TARGET) +SOURCESUFFIX=$(FULL_SOURCE) +endif +ifneq ($(FULL_TARGET),$(FULL_SOURCE)) +CROSSCOMPILE=1 +endif +ifeq ($(findstring makefile,$(MAKECMDGOALS)),) +ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),) +$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first) +endif +endif +ifneq ($(findstring $(OS_TARGET),$(BSDs)),) +BSDhier=1 +endif +ifeq ($(OS_TARGET),linux) +linuxHier=1 +endif +export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +else +override FPCDIR=wrong +endif +ifdef DEFAULT_FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR)) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=wrong +endif +endif +endif +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR:=$(BASEDIR) +ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX)) +endif +ifndef BINUTILSPREFIX +ifndef CROSSBINDIR +ifdef CROSSCOMPILE +BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)- +endif +endif +endif +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX)) +ifeq ($(UNITSDIR),) +UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET)) +endif +PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra) +override PACKAGE_NAME=fpgui +override PACKAGE_VERSION=0.2 +ifeq ($(FULL_TARGET),i386-linux) +override TARGET_UNITS+=fpgui +endif +override INSTALL_BUILDUNIT=fpgui +override INSTALL_FPCPACKAGE=y +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_OPTIONS+=-S2h +endif +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_INCLUDEDIR+=defimpl +endif +ifeq ($(FULL_TARGET),i386-linux) +override COMPILER_UNITTARGETDIR+=units +endif +ifdef REQUIRE_UNITSDIR +override UNITSDIR+=$(REQUIRE_UNITSDIR) +endif +ifdef REQUIRE_PACKAGESDIR +override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR) +endif +ifdef ZIPINSTALL +ifneq ($(findstring $(OS_TARGET),$(UNIXs)),) +UNIXHier=1 +endif +else +ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),) +UNIXHier=1 +endif +endif +ifndef INSTALL_PREFIX +ifdef PREFIX +INSTALL_PREFIX=$(PREFIX) +endif +endif +ifndef INSTALL_PREFIX +ifdef UNIXHier +INSTALL_PREFIX=/usr/local +else +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=/pp +else +INSTALL_BASEDIR:=/$(PACKAGE_NAME) +endif +endif +endif +export INSTALL_PREFIX +ifdef INSTALL_FPCSUBDIR +export INSTALL_FPCSUBDIR +endif +ifndef DIST_DESTDIR +DIST_DESTDIR:=$(BASEDIR) +endif +export DIST_DESTDIR +ifndef COMPILER_UNITTARGETDIR +ifdef PACKAGEDIR_MAIN +COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX) +else +COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX) +endif +endif +ifndef COMPILER_TARGETDIR +COMPILER_TARGETDIR=. +endif +ifndef INSTALL_BASEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION) +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME) +endif +else +INSTALL_BASEDIR:=$(INSTALL_PREFIX) +endif +endif +ifndef INSTALL_BINDIR +ifdef UNIXHier +INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin +else +INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin +ifdef INSTALL_FPCPACKAGE +ifdef CROSSCOMPILE +ifdef CROSSINSTALL +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX) +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +else +INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX) +endif +endif +endif +endif +ifndef INSTALL_UNITDIR +INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX) +ifdef INSTALL_FPCPACKAGE +ifdef PACKAGE_NAME +INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME) +endif +endif +endif +ifndef INSTALL_LIBDIR +ifdef UNIXHier +INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib +else +INSTALL_LIBDIR:=$(INSTALL_UNITDIR) +endif +endif +ifndef INSTALL_SOURCEDIR +ifdef UNIXHier +ifdef BSDhier +SRCPREFIXDIR=share/src +else +ifdef linuxHier +SRCPREFIXDIR=share/src +else +SRCPREFIXDIR=src +endif +endif +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +ifdef INSTALL_FPCSUBDIR +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME) +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME) +endif +else +INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source +endif +endif +endif +ifndef INSTALL_DOCDIR +ifdef UNIXHier +ifdef BSDhier +DOCPREFIXDIR=share/doc +else +ifdef linuxHier +DOCPREFIXDIR=share/doc +else +DOCPREFIXDIR=doc +endif +endif +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME) +else +INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc +endif +endif +endif +ifndef INSTALL_EXAMPLEDIR +ifdef UNIXHier +ifdef INSTALL_FPCPACKAGE +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME) +endif +endif +else +ifdef BSDhier +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +ifdef linuxHier +INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION) +endif +endif +endif +else +ifdef INSTALL_FPCPACKAGE +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME) +else +INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples +endif +endif +endif +ifndef INSTALL_DATADIR +INSTALL_DATADIR=$(INSTALL_BASEDIR) +endif +ifndef INSTALL_SHAREDDIR +INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib +endif +ifdef CROSSCOMPILE +ifndef CROSSBINDIR +CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX)) +ifeq ($(CROSSBINDIR),) +CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE)) +endif +endif +else +CROSSBINDIR= +endif +ifeq ($(OS_SOURCE),linux) +ifndef GCCLIBDIR +ifeq ($(CPU_TARGET),i386) +ifneq ($(findstring x86_64,$(shell uname -a)),) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`) +endif +endif +endif +ifeq ($(CPU_TARGET),powerpc64) +ifeq ($(BINUTILSPREFIX),) +GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`) +endif +endif +endif +ifndef GCCLIBDIR +CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH)))) +ifneq ($(CROSSGCC),) +GCCLIBDIR:=$(shell dirname `$(CROSSGCC) -print-libgcc-file-name`) +endif +endif +ifndef OTHERLIBDIR +OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }') +endif +endif +ifdef inUnix +ifeq ($(OS_SOURCE),netbsd) +OTHERLIBDIR+=/usr/pkg/lib +endif +export GCCLIBDIR OTHERLIB +endif +BATCHEXT=.bat +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +SHAREDLIBPREFIX=libfp +STATICLIBPREFIX=libp +IMPORTLIBPREFIX=libimp +RSTEXT=.rst +ifeq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),go32v1) +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +OEXT=.obj +ASMEXT=.asm +SHAREDLIBEXT=.dll +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),emx) +BATCHEXT=.cmd +AOUTEXT=.out +STATICLIBPREFIX= +SHAREDLIBEXT=.dll +SHORTSUFFIX=emx +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),morphos) +EXEEXT= +SHAREDLIBEXT=.library +SHORTSUFFIX=mos +endif +ifeq ($(OS_TARGET),atari) +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +EXEEXT=.nlm +STATICLIBPREFIX= +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +ifeq ($(OS_TARGET),darwin) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=dwn +endif +ifeq ($(OS_TARGET),gba) +EXEEXT=.gba +SHAREDLIBEXT=.so +SHORTSUFFIX=gba +endif +else +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +STATICLIBPREFIX= +SHORTSUFFIX=v1 +endif +ifeq ($(OS_TARGET),go32v2) +STATICLIBPREFIX= +SHORTSUFFIX=dos +endif +ifeq ($(OS_TARGET),watcom) +STATICLIBPREFIX= +SHORTSUFFIX=wat +endif +ifeq ($(OS_TARGET),linux) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=lnx +endif +ifeq ($(OS_TARGET),freebsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=fbs +endif +ifeq ($(OS_TARGET),netbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=nbs +endif +ifeq ($(OS_TARGET),openbsd) +BATCHEXT=.sh +EXEEXT= +HASSHAREDLIB=1 +SHORTSUFFIX=obs +endif +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +SHORTSUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +BATCHEXT=.cmd +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +AOUTEXT=.out +SMARTEXT=.sl2 +STATICLIBPREFIX= +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +SHORTSUFFIX=os2 +ECHO=echo +endif +ifeq ($(OS_TARGET),amiga) +EXEEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.library +SHORTSUFFIX=amg +endif +ifeq ($(OS_TARGET),atari) +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT=.ttp +SHORTSUFFIX=ata +endif +ifeq ($(OS_TARGET),beos) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=be +endif +ifeq ($(OS_TARGET),solaris) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=sun +endif +ifeq ($(OS_TARGET),qnx) +BATCHEXT=.sh +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +SHORTSUFFIX=qnx +endif +ifeq ($(OS_TARGET),netware) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nw +endif +ifeq ($(OS_TARGET),netwlibc) +STATICLIBPREFIX= +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.nlm +EXEEXT=.nlm +SHORTSUFFIX=nwl +endif +ifeq ($(OS_TARGET),macos) +BATCHEXT= +PPUEXT=.ppu +ASMEXT=.s +OEXT=.o +SMARTEXT=.sl +STATICLIBEXT=.a +EXEEXT= +DEBUGSYMEXT=.xcoff +SHORTSUFFIX=mac +endif +endif +ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),) +FPCMADE=fpcmade.$(SHORTSUFFIX) +ZIPSUFFIX=$(SHORTSUFFIX) +ZIPCROSSPREFIX= +ZIPSOURCESUFFIX=src +ZIPEXAMPLESUFFIX=exm +else +FPCMADE=fpcmade.$(TARGETSUFFIX) +ZIPSOURCESUFFIX=.source +ZIPEXAMPLESUFFIX=.examples +ifdef CROSSCOMPILE +ZIPSUFFIX=.$(SOURCESUFFIX) +ZIPCROSSPREFIX=$(TARGETSUFFIX)- +else +ZIPSUFFIX=.$(TARGETSUFFIX) +ZIPCROSSPREFIX= +endif +endif +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO= __missing_command_ECHO +else +ECHO:=$(firstword $(ECHO)) +endif +else +ECHO:=$(firstword $(ECHO)) +endif +endif +export ECHO +ifndef DATE +DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(DATE),) +DATE= __missing_command_DATE +else +DATE:=$(firstword $(DATE)) +endif +else +DATE:=$(firstword $(DATE)) +endif +endif +export DATE +ifndef GINSTALL +GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(GINSTALL),) +GINSTALL= __missing_command_GINSTALL +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +else +GINSTALL:=$(firstword $(GINSTALL)) +endif +endif +export GINSTALL +ifndef CPPROG +CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(CPPROG),) +CPPROG= __missing_command_CPPROG +else +CPPROG:=$(firstword $(CPPROG)) +endif +endif +export CPPROG +ifndef RMPROG +RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(RMPROG),) +RMPROG= __missing_command_RMPROG +else +RMPROG:=$(firstword $(RMPROG)) +endif +endif +export RMPROG +ifndef MVPROG +MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MVPROG),) +MVPROG= __missing_command_MVPROG +else +MVPROG:=$(firstword $(MVPROG)) +endif +endif +export MVPROG +ifndef MKDIRPROG +MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(MKDIRPROG),) +MKDIRPROG= __missing_command_MKDIRPROG +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +else +MKDIRPROG:=$(firstword $(MKDIRPROG)) +endif +endif +export MKDIRPROG +ifndef ECHOREDIR +ifndef inUnix +ECHOREDIR=echo +else +ECHOREDIR=$(ECHO) +endif +endif +ifndef COPY +COPY:=$(CPPROG) -fp +endif +ifndef COPYTREE +COPYTREE:=$(CPPROG) -Rfp +endif +ifndef MKDIRTREE +MKDIRTREE:=$(MKDIRPROG) -p +endif +ifndef MOVE +MOVE:=$(MVPROG) -f +endif +ifndef DEL +DEL:=$(RMPROG) -f +endif +ifndef DELTREE +DELTREE:=$(RMPROG) -rf +endif +ifndef INSTALL +ifdef inUnix +INSTALL:=$(GINSTALL) -c -m 644 +else +INSTALL:=$(COPY) +endif +endif +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=$(GINSTALL) -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif +ifndef MKDIR +MKDIR:=$(GINSTALL) -m 755 -d +endif +export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= __missing_command_PPUMOVE +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE +ifndef FPCMAKE +FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(FPCMAKE),) +FPCMAKE= __missing_command_FPCMAKE +else +FPCMAKE:=$(firstword $(FPCMAKE)) +endif +endif +export FPCMAKE +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= __missing_command_ZIPPROG +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= __missing_command_TARPROG +else +TARPROG:=$(firstword $(TARPROG)) +endif +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG +ASNAME=$(BINUTILSPREFIX)as +LDNAME=$(BINUTILSPREFIX)ld +ARNAME=$(BINUTILSPREFIX)ar +RCNAME=$(BINUTILSPREFIX)rc +ifneq ($(findstring 1.0.,$(FPC_VERSION)),) +ifeq ($(OS_TARGET),win32) +ifeq ($(CROSSBINDIR),) +ASNAME=asw +LDNAME=ldw +ARNAME=arw +endif +endif +endif +ifndef ASPROG +ifdef CROSSBINDIR +ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT) +else +ASPROG=$(ASNAME) +endif +endif +ifndef LDPROG +ifdef CROSSBINDIR +LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT) +else +LDPROG=$(LDNAME) +endif +endif +ifndef RCPROG +ifdef CROSSBINDIR +RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT) +else +RCPROG=$(RCNAME) +endif +endif +ifndef ARPROG +ifdef CROSSBINDIR +ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT) +else +ARPROG=$(ARNAME) +endif +endif +AS=$(ASPROG) +LD=$(LDPROG) +RC=$(RCPROG) +AR=$(ARPROG) +PPAS=ppas$(SRCBATCHEXT) +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif +ifdef DATE +DATESTR:=$(shell $(DATE) +%Y%m%d) +else +DATESTR= +endif +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG +ZIPOPT=-9 +ZIPEXT=.zip +ifeq ($(USETAR),bz2) +TAROPT=vj +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif +override REQUIRE_PACKAGES=rtl fcl fpgfx +ifeq ($(FULL_TARGET),i386-linux) +REQUIRE_PACKAGES_RTL=1 +REQUIRE_PACKAGES_HASH=1 +REQUIRE_PACKAGES_PASZLIB=1 +REQUIRE_PACKAGES_NETDB=1 +REQUIRE_PACKAGES_LIBASYNC=1 +REQUIRE_PACKAGES_PTHREADS=1 +REQUIRE_PACKAGES_FCL=1 +REQUIRE_PACKAGES_FPGFX=1 +REQUIRE_PACKAGES_PASJPEG=1 +REQUIRE_PACKAGES_IBASE=1 +REQUIRE_PACKAGES_POSTGRES=1 +REQUIRE_PACKAGES_MYSQL=1 +REQUIRE_PACKAGES_ODBC=1 +REQUIRE_PACKAGES_ORACLE=1 +REQUIRE_PACKAGES_SQLITE=1 +endif +ifdef REQUIRE_PACKAGES_RTL +PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_RTL),) +ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),) +UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX) +else +UNITDIR_RTL=$(PACKAGEDIR_RTL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_RTL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE) +endif +else +PACKAGEDIR_RTL= +UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_RTL),) +UNITDIR_RTL:=$(firstword $(UNITDIR_RTL)) +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override COMPILER_UNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef REQUIRE_PACKAGES_HASH +PACKAGEDIR_HASH:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /hash/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_HASH),) +ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)),) +UNITDIR_HASH=$(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX) +else +UNITDIR_HASH=$(PACKAGEDIR_HASH) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_HASH)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_HASH) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_HASH)/$(FPCMADE) +endif +else +PACKAGEDIR_HASH= +UNITDIR_HASH:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /hash/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_HASH),) +UNITDIR_HASH:=$(firstword $(UNITDIR_HASH)) +else +UNITDIR_HASH= +endif +endif +ifdef UNITDIR_HASH +override COMPILER_UNITDIR+=$(UNITDIR_HASH) +endif +endif +ifdef REQUIRE_PACKAGES_PASZLIB +PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_PASZLIB),) +ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX)),) +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX) +else +UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PASZLIB)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PASZLIB) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PASZLIB)/$(FPCMADE) +endif +else +PACKAGEDIR_PASZLIB= +UNITDIR_PASZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASZLIB),) +UNITDIR_PASZLIB:=$(firstword $(UNITDIR_PASZLIB)) +else +UNITDIR_PASZLIB= +endif +endif +ifdef UNITDIR_PASZLIB +override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB) +endif +endif +ifdef REQUIRE_PACKAGES_NETDB +PACKAGEDIR_NETDB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /netdb/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_NETDB),) +ifneq ($(wildcard $(PACKAGEDIR_NETDB)/units/$(TARGETSUFFIX)),) +UNITDIR_NETDB=$(PACKAGEDIR_NETDB)/units/$(TARGETSUFFIX) +else +UNITDIR_NETDB=$(PACKAGEDIR_NETDB) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_NETDB)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_NETDB) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_NETDB)/$(FPCMADE) +endif +else +PACKAGEDIR_NETDB= +UNITDIR_NETDB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /netdb/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_NETDB),) +UNITDIR_NETDB:=$(firstword $(UNITDIR_NETDB)) +else +UNITDIR_NETDB= +endif +endif +ifdef UNITDIR_NETDB +override COMPILER_UNITDIR+=$(UNITDIR_NETDB) +endif +endif +ifdef REQUIRE_PACKAGES_LIBASYNC +PACKAGEDIR_LIBASYNC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /libasync/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_LIBASYNC),) +ifneq ($(wildcard $(PACKAGEDIR_LIBASYNC)/units/$(TARGETSUFFIX)),) +UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC)/units/$(TARGETSUFFIX) +else +UNITDIR_LIBASYNC=$(PACKAGEDIR_LIBASYNC) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_LIBASYNC)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_LIBASYNC) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_LIBASYNC)/$(FPCMADE) +endif +else +PACKAGEDIR_LIBASYNC= +UNITDIR_LIBASYNC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /libasync/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_LIBASYNC),) +UNITDIR_LIBASYNC:=$(firstword $(UNITDIR_LIBASYNC)) +else +UNITDIR_LIBASYNC= +endif +endif +ifdef UNITDIR_LIBASYNC +override COMPILER_UNITDIR+=$(UNITDIR_LIBASYNC) +endif +endif +ifdef REQUIRE_PACKAGES_PTHREADS +PACKAGEDIR_PTHREADS:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pthreads/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_PTHREADS),) +ifneq ($(wildcard $(PACKAGEDIR_PTHREADS)/units/$(TARGETSUFFIX)),) +UNITDIR_PTHREADS=$(PACKAGEDIR_PTHREADS)/units/$(TARGETSUFFIX) +else +UNITDIR_PTHREADS=$(PACKAGEDIR_PTHREADS) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PTHREADS)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PTHREADS) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PTHREADS)/$(FPCMADE) +endif +else +PACKAGEDIR_PTHREADS= +UNITDIR_PTHREADS:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /pthreads/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PTHREADS),) +UNITDIR_PTHREADS:=$(firstword $(UNITDIR_PTHREADS)) +else +UNITDIR_PTHREADS= +endif +endif +ifdef UNITDIR_PTHREADS +override COMPILER_UNITDIR+=$(UNITDIR_PTHREADS) +endif +endif +ifdef REQUIRE_PACKAGES_FCL +PACKAGEDIR_FCL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_FCL),) +ifneq ($(wildcard $(PACKAGEDIR_FCL)/units/$(TARGETSUFFIX)),) +UNITDIR_FCL=$(PACKAGEDIR_FCL)/units/$(TARGETSUFFIX) +else +UNITDIR_FCL=$(PACKAGEDIR_FCL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_FCL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_FCL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_FCL)/$(FPCMADE) +endif +else +PACKAGEDIR_FCL= +UNITDIR_FCL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fcl/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FCL),) +UNITDIR_FCL:=$(firstword $(UNITDIR_FCL)) +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override COMPILER_UNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef REQUIRE_PACKAGES_FPGFX +PACKAGEDIR_FPGFX:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fpgfx/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_FPGFX),) +ifneq ($(wildcard $(PACKAGEDIR_FPGFX)/units/$(TARGETSUFFIX)),) +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX)/units/$(TARGETSUFFIX) +else +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_FPGFX)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_FPGFX) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_FPGFX)/$(FPCMADE) +endif +else +PACKAGEDIR_FPGFX= +UNITDIR_FPGFX:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /fpgfx/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_FPGFX),) +UNITDIR_FPGFX:=$(firstword $(UNITDIR_FPGFX)) +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override COMPILER_UNITDIR+=$(UNITDIR_FPGFX) +endif +endif +ifdef REQUIRE_PACKAGES_PASJPEG +PACKAGEDIR_PASJPEG:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pasjpeg/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_PASJPEG),) +ifneq ($(wildcard $(PACKAGEDIR_PASJPEG)/units/$(TARGETSUFFIX)),) +UNITDIR_PASJPEG=$(PACKAGEDIR_PASJPEG)/units/$(TARGETSUFFIX) +else +UNITDIR_PASJPEG=$(PACKAGEDIR_PASJPEG) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_PASJPEG)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_PASJPEG) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_PASJPEG)/$(FPCMADE) +endif +else +PACKAGEDIR_PASJPEG= +UNITDIR_PASJPEG:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /pasjpeg/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_PASJPEG),) +UNITDIR_PASJPEG:=$(firstword $(UNITDIR_PASJPEG)) +else +UNITDIR_PASJPEG= +endif +endif +ifdef UNITDIR_PASJPEG +override COMPILER_UNITDIR+=$(UNITDIR_PASJPEG) +endif +endif +ifdef REQUIRE_PACKAGES_IBASE +PACKAGEDIR_IBASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ibase/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_IBASE),) +ifneq ($(wildcard $(PACKAGEDIR_IBASE)/units/$(TARGETSUFFIX)),) +UNITDIR_IBASE=$(PACKAGEDIR_IBASE)/units/$(TARGETSUFFIX) +else +UNITDIR_IBASE=$(PACKAGEDIR_IBASE) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_IBASE)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_IBASE) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_IBASE)/$(FPCMADE) +endif +else +PACKAGEDIR_IBASE= +UNITDIR_IBASE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /ibase/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_IBASE),) +UNITDIR_IBASE:=$(firstword $(UNITDIR_IBASE)) +else +UNITDIR_IBASE= +endif +endif +ifdef UNITDIR_IBASE +override COMPILER_UNITDIR+=$(UNITDIR_IBASE) +endif +endif +ifdef REQUIRE_PACKAGES_POSTGRES +PACKAGEDIR_POSTGRES:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /postgres/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_POSTGRES),) +ifneq ($(wildcard $(PACKAGEDIR_POSTGRES)/units/$(TARGETSUFFIX)),) +UNITDIR_POSTGRES=$(PACKAGEDIR_POSTGRES)/units/$(TARGETSUFFIX) +else +UNITDIR_POSTGRES=$(PACKAGEDIR_POSTGRES) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_POSTGRES)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_POSTGRES) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_POSTGRES)/$(FPCMADE) +endif +else +PACKAGEDIR_POSTGRES= +UNITDIR_POSTGRES:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /postgres/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_POSTGRES),) +UNITDIR_POSTGRES:=$(firstword $(UNITDIR_POSTGRES)) +else +UNITDIR_POSTGRES= +endif +endif +ifdef UNITDIR_POSTGRES +override COMPILER_UNITDIR+=$(UNITDIR_POSTGRES) +endif +endif +ifdef REQUIRE_PACKAGES_MYSQL +PACKAGEDIR_MYSQL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /mysql/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_MYSQL),) +ifneq ($(wildcard $(PACKAGEDIR_MYSQL)/units/$(TARGETSUFFIX)),) +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL)/units/$(TARGETSUFFIX) +else +UNITDIR_MYSQL=$(PACKAGEDIR_MYSQL) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_MYSQL)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_MYSQL) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_MYSQL)/$(FPCMADE) +endif +else +PACKAGEDIR_MYSQL= +UNITDIR_MYSQL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /mysql/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_MYSQL),) +UNITDIR_MYSQL:=$(firstword $(UNITDIR_MYSQL)) +else +UNITDIR_MYSQL= +endif +endif +ifdef UNITDIR_MYSQL +override COMPILER_UNITDIR+=$(UNITDIR_MYSQL) +endif +endif +ifdef REQUIRE_PACKAGES_ODBC +PACKAGEDIR_ODBC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /odbc/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_ODBC),) +ifneq ($(wildcard $(PACKAGEDIR_ODBC)/units/$(TARGETSUFFIX)),) +UNITDIR_ODBC=$(PACKAGEDIR_ODBC)/units/$(TARGETSUFFIX) +else +UNITDIR_ODBC=$(PACKAGEDIR_ODBC) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_ODBC)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_ODBC) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_ODBC)/$(FPCMADE) +endif +else +PACKAGEDIR_ODBC= +UNITDIR_ODBC:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /odbc/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_ODBC),) +UNITDIR_ODBC:=$(firstword $(UNITDIR_ODBC)) +else +UNITDIR_ODBC= +endif +endif +ifdef UNITDIR_ODBC +override COMPILER_UNITDIR+=$(UNITDIR_ODBC) +endif +endif +ifdef REQUIRE_PACKAGES_ORACLE +PACKAGEDIR_ORACLE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /oracle/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_ORACLE),) +ifneq ($(wildcard $(PACKAGEDIR_ORACLE)/units/$(TARGETSUFFIX)),) +UNITDIR_ORACLE=$(PACKAGEDIR_ORACLE)/units/$(TARGETSUFFIX) +else +UNITDIR_ORACLE=$(PACKAGEDIR_ORACLE) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_ORACLE)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_ORACLE) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_ORACLE)/$(FPCMADE) +endif +else +PACKAGEDIR_ORACLE= +UNITDIR_ORACLE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /oracle/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_ORACLE),) +UNITDIR_ORACLE:=$(firstword $(UNITDIR_ORACLE)) +else +UNITDIR_ORACLE= +endif +endif +ifdef UNITDIR_ORACLE +override COMPILER_UNITDIR+=$(UNITDIR_ORACLE) +endif +endif +ifdef REQUIRE_PACKAGES_SQLITE +PACKAGEDIR_SQLITE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /sqlite/Makefile.fpc,$(PACKAGESDIR)))))) +ifneq ($(PACKAGEDIR_SQLITE),) +ifneq ($(wildcard $(PACKAGEDIR_SQLITE)/units/$(TARGETSUFFIX)),) +UNITDIR_SQLITE=$(PACKAGEDIR_SQLITE)/units/$(TARGETSUFFIX) +else +UNITDIR_SQLITE=$(PACKAGEDIR_SQLITE) +endif +ifdef CHECKDEPEND +$(PACKAGEDIR_SQLITE)/$(FPCMADE): + $(MAKE) -C $(PACKAGEDIR_SQLITE) $(FPCMADE) +override ALLDEPENDENCIES+=$(PACKAGEDIR_SQLITE)/$(FPCMADE) +endif +else +PACKAGEDIR_SQLITE= +UNITDIR_SQLITE:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /sqlite/Package.fpc,$(UNITSDIR))))) +ifneq ($(UNITDIR_SQLITE),) +UNITDIR_SQLITE:=$(firstword $(UNITDIR_SQLITE)) +else +UNITDIR_SQLITE= +endif +endif +ifdef UNITDIR_SQLITE +override COMPILER_UNITDIR+=$(UNITDIR_SQLITE) +endif +endif +ifndef NOCPUDEF +override FPCOPTDEF=$(CPU_TARGET) +endif +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif +ifneq ($(CPU_TARGET),$(CPU_SOURCE)) +override FPCOPT+=-P$(CPU_TARGET) +endif +ifeq ($(OS_SOURCE),openbsd) +override FPCOPT+=-FD$(NEW_BINUTILS_PATH) +endif +ifndef CROSSBOOTSTRAP +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc +endif +ifneq ($(BINUTILSPREFIX),) +override FPCOPT+=-Xr$(RLINKPATH) +endif +endif +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif +ifdef LINKSMART +override FPCOPT+=-XX +endif +ifdef CREATESMART +override FPCOPT+=-CX +endif +ifdef DEBUG +override FPCOPT+=-gl +override FPCOPTDEF+=DEBUG +endif +ifdef RELEASE +ifneq ($(findstring 2.0.,$(FPC_VERSION)),) +ifeq ($(CPU_TARGET),i386) +FPCCPUOPT:=-OG2p3 +endif +ifeq ($(CPU_TARGET),powerpc) +FPCCPUOPT:=-O1r +endif +else +FPCCPUOPT:=-O1r +endif +override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n +override FPCOPTDEF+=RELEASE +endif +ifdef STRIP +override FPCOPT+=-Xs +endif +ifdef OPTIMIZE +override FPCOPT+=-O2 +endif +ifdef VERBOSE +override FPCOPT+=-vwni +endif +ifdef COMPILER_OPTIONS +override FPCOPT+=$(COMPILER_OPTIONS) +endif +ifdef COMPILER_UNITDIR +override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR)) +endif +ifdef COMPILER_LIBRARYDIR +override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR)) +endif +ifdef COMPILER_OBJECTDIR +override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR)) +endif +ifdef COMPILER_INCLUDEDIR +override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR)) +endif +ifdef CROSSBINDIR +override FPCOPT+=-FD$(CROSSBINDIR) +endif +ifdef COMPILER_TARGETDIR +override FPCOPT+=-FE$(COMPILER_TARGETDIR) +ifeq ($(COMPILER_TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/ +endif +endif +ifdef COMPILER_UNITTARGETDIR +override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR) +ifeq ($(COMPILER_UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/ +endif +else +ifdef COMPILER_TARGETDIR +override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif +ifdef CREATESHARED +override FPCOPT+=-Cg +ifeq ($(CPU_TARGET),i386) +override FPCOPT+=-Aas +endif +endif +ifdef LINKSHARED +endif +ifdef GCCLIBDIR +override FPCOPT+=-Fl$(GCCLIBDIR) +endif +ifdef OTHERLIBDIR +override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR)) +endif +ifdef OPT +override FPCOPT+=$(OPT) +endif +ifdef FPCOPTDEF +override FPCOPT+=$(addprefix -d,$(FPCOPTDEF)) +endif +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif +ifdef USEENV +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif +override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET) +override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE) +ifneq ($(AFULL_TARGET),$(AFULL_SOURCE)) +override ACROSSCOMPILE=1 +endif +ifdef ACROSSCOMPILE +override FPCOPT+=$(CROSSOPT) +endif +override COMPILER:=$(FPC) $(FPCOPT) +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(FULL_SOURCE),$(FULL_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif +.PHONY: fpc_units +ifneq ($(TARGET_UNITS),) +override ALLTARGET+=fpc_units +override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS)) +override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS)) +override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES) +override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES) +endif +fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES) +ifdef TARGET_RSTS +override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS)) +override CLEANRSTFILES+=$(RSTFILES) +endif +.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared +$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET) + @$(ECHOREDIR) Compiled > $(FPCMADE) +fpc_all: $(FPCMADE) +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 +fpc_debug: + $(MAKE) all DEBUG=1 +fpc_release: + $(MAKE) all RELEASE=1 +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res +$(COMPILER_UNITTARGETDIR): + $(MKDIRTREE) $(COMPILER_UNITTARGETDIR) +$(COMPILER_TARGETDIR): + $(MKDIRTREE) $(COMPILER_TARGETDIR) +%$(PPUEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(PPUEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pp + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.pas + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.lpr + $(COMPILER) $< + $(EXECPPAS) +%$(EXEEXT): %.dpr + $(COMPILER) $< + $(EXECPPAS) +%.res: %.rc + windres -i $< -o $@ +vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR) +vpath %$(OEXT) $(COMPILER_UNITTARGETDIR) +vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR) +.PHONY: fpc_shared +override INSTALLTARGET+=fpc_shared_install +ifndef SHARED_LIBVERSION +SHARED_LIBVERSION=$(FPC_VERSION) +endif +ifndef SHARED_LIBNAME +SHARED_LIBNAME=$(PACKAGE_NAME) +endif +ifndef SHARED_FULLNAME +SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT) +endif +ifndef SHARED_LIBUNITS +SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS) +override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS)) +endif +fpc_shared: +ifdef HASSHAREDLIB + $(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1 +ifneq ($(SHARED_BUILD),n) + $(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR) +endif +else + @$(ECHO) Shared Libraries not supported +endif +fpc_shared_install: +ifneq ($(SHARED_BUILD),n) +ifneq ($(SHARED_LIBUNITS),) +ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),) + $(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR) +endif +endif +endif +.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall +ifdef INSTALL_UNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS)) +endif +ifdef INSTALL_BUILDUNIT +override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES)) +endif +ifdef INSTALLPPUFILES +override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) +ifneq ($(UNITTARGETDIRPREFIX),) +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES))) +override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES)))) +endif +override INSTALL_CREATEPACKAGEFPC=1 +endif +ifdef INSTALLEXEFILES +ifneq ($(TARGETDIRPREFIX),) +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES))) +endif +endif +fpc_install: all $(INSTALLTARGET) +ifdef INSTALLEXEFILES + $(MKDIR) $(INSTALL_BINDIR) +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR) +endif +ifdef INSTALL_CREATEPACKAGEFPC +ifdef FPCMAKE +ifdef PACKAGE_VERSION +ifneq ($(wildcard Makefile.fpc),) + $(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) Package.fpc $(INSTALL_UNITDIR) +endif +endif +endif +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(INSTALL_UNITDIR) + $(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR) +endif +ifneq ($(wildcard $(LIB_FULLNAME)),) + $(MKDIR) $(INSTALL_LIBDIR) + $(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR) +ifdef inUnix + ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME) +endif +endif +endif +ifdef INSTALL_FILES + $(MKDIR) $(INSTALL_DATADIR) + $(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR) +endif +fpc_sourceinstall: distclean + $(MKDIR) $(INSTALL_SOURCEDIR) + $(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR) +fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS)) +ifdef HASEXAMPLES + $(MKDIR) $(INSTALL_EXAMPLEDIR) +endif +ifdef EXAMPLESOURCEFILES + $(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR) +endif +ifdef TARGET_EXAMPLEDIRS + $(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR) +endif +.PHONY: fpc_distinstall +fpc_distinstall: install exampleinstall +.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/../fpc-pack +else +PACKDIR=/tmp/fpc-pack +endif +endif +ifndef ZIPNAME +ifdef DIST_ZIPNAME +ZIPNAME=$(DIST_ZIPNAME) +else +ZIPNAME=$(PACKAGE_NAME) +endif +endif +ifndef FULLZIPNAME +FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX) +endif +ifndef ZIPTARGET +ifdef DIST_ZIPTARGET +ZIPTARGET=DIST_ZIPTARGET +else +ZIPTARGET=install +endif +endif +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif +ifndef inUnix +USEZIPWRAPPER=1 +endif +ifdef USEZIPWRAPPER +ZIPPATHSEP=$(PATHSEP) +ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT)) +else +ZIPPATHSEP=/ +endif +ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR)) +ifdef USETAR +ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT) +ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * +else +ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +endif +fpc_zipinstall: + $(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1 + $(MKDIR) $(DIST_DESTDIR) + $(DEL) $(ZIPDESTFILE) +ifdef USEZIPWRAPPER +ifneq ($(ECHOREDIR),echo) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER) + $(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER) +else + echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) +endif +ifdef inUnix + /bin/sh $(ZIPWRAPPER) +else + $(ZIPWRAPPER) +endif + $(DEL) $(ZIPWRAPPER) +else + $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) +endif + $(DELTREE) $(PACKDIR) +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX) +fpc_zipexampleinstall: +ifdef HASEXAMPLES + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX) +endif +fpc_zipdistinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=distinstall +.PHONY: fpc_clean fpc_cleanall fpc_distclean +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif +ifdef CLEAN_UNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS)) +endif +ifdef CLEANPPUFILES +override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) +ifdef DEBUGSYMEXT +override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES)) +endif +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))) +endif +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef CLEAN_FILES + -$(DEL) $(CLEAN_FILES) +endif +ifdef LIB_NAME + -$(DEL) $(LIB_NAME) $(LIB_FULLNAME) +endif + -$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT) +fpc_cleanall: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef COMPILER_UNITTARGETDIR +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +endif + -$(DELTREE) units + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) +ifneq ($(PPUEXT),.ppu) + -$(DEL) *.o *.ppu *.a +endif + -$(DELTREE) *$(SMARTEXT) + -$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE) + -$(DEL) *_ppas$(BATCHEXT) +ifdef AOUTEXT + -$(DEL) *$(AOUTEXT) +endif +ifdef DEBUGSYMEXT + -$(DEL) *$(DEBUGSYMEXT) +endif +fpc_distclean: cleanall +.PHONY: fpc_baseinfo +override INFORULES+=fpc_baseinfo +fpc_baseinfo: + @$(ECHO) + @$(ECHO) == Package info == + @$(ECHO) Package Name..... $(PACKAGE_NAME) + @$(ECHO) Package Version.. $(PACKAGE_VERSION) + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC.......... $(FPC) + @$(ECHO) FPC Version.. $(FPC_VERSION) + @$(ECHO) Source CPU... $(CPU_SOURCE) + @$(ECHO) Target CPU... $(CPU_TARGET) + @$(ECHO) Source OS.... $(OS_SOURCE) + @$(ECHO) Target OS.... $(OS_TARGET) + @$(ECHO) Full Source.. $(FULL_SOURCE) + @$(ECHO) Full Target.. $(FULL_TARGET) + @$(ECHO) SourceSuffix. $(SOURCESUFFIX) + @$(ECHO) TargetSuffix. $(TARGETSUFFIX) + @$(ECHO) + @$(ECHO) == Directory info == + @$(ECHO) + @$(ECHO) Required pkgs... $(REQUIRE_PACKAGES) + @$(ECHO) + @$(ECHO) Basedir......... $(BASEDIR) + @$(ECHO) FPCDir.......... $(FPCDIR) + @$(ECHO) CrossBinDir..... $(CROSSBINDIR) + @$(ECHO) UnitsDir........ $(UNITSDIR) + @$(ECHO) PackagesDir..... $(PACKAGESDIR) + @$(ECHO) + @$(ECHO) GCC library..... $(GCCLIBDIR) + @$(ECHO) Other library... $(OTHERLIBDIR) + @$(ECHO) + @$(ECHO) == Tools info == + @$(ECHO) + @$(ECHO) As........ $(AS) + @$(ECHO) Ld........ $(LD) + @$(ECHO) Ar........ $(AR) + @$(ECHO) Rc........ $(RC) + @$(ECHO) + @$(ECHO) Mv........ $(MVPROG) + @$(ECHO) Cp........ $(CPPROG) + @$(ECHO) Rm........ $(RMPROG) + @$(ECHO) GInstall.. $(GINSTALL) + @$(ECHO) Echo...... $(ECHO) + @$(ECHO) Shell..... $(SHELL) + @$(ECHO) Date...... $(DATE) + @$(ECHO) FPCMake... $(FPCMAKE) + @$(ECHO) PPUMove... $(PPUMOVE) + @$(ECHO) Upx....... $(UPXPROG) + @$(ECHO) Zip....... $(ZIPPROG) + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) Target Loaders........ $(TARGET_LOADERS) + @$(ECHO) Target Units.......... $(TARGET_UNITS) + @$(ECHO) Target Implicit Units. $(TARGET_IMPLICITUNITS) + @$(ECHO) Target Programs....... $(TARGET_PROGRAMS) + @$(ECHO) Target Dirs........... $(TARGET_DIRS) + @$(ECHO) Target Examples....... $(TARGET_EXAMPLES) + @$(ECHO) Target ExampleDirs.... $(TARGET_EXAMPLEDIRS) + @$(ECHO) + @$(ECHO) Clean Units......... $(CLEAN_UNITS) + @$(ECHO) Clean Files......... $(CLEAN_FILES) + @$(ECHO) + @$(ECHO) Install Units....... $(INSTALL_UNITS) + @$(ECHO) Install Files....... $(INSTALL_FILES) + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) + @$(ECHO) DateStr.............. $(DATESTR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) ZipPrefix............ $(ZIPPREFIX) + @$(ECHO) ZipCrossPrefix....... $(ZIPCROSSPREFIX) + @$(ECHO) ZipSuffix............ $(ZIPSUFFIX) + @$(ECHO) FullZipName.......... $(FULLZIPNAME) + @$(ECHO) Install FPC Package.. $(INSTALL_FPCPACKAGE) + @$(ECHO) + @$(ECHO) Install base dir..... $(INSTALL_BASEDIR) + @$(ECHO) Install binary dir... $(INSTALL_BINDIR) + @$(ECHO) Install library dir.. $(INSTALL_LIBDIR) + @$(ECHO) Install units dir.... $(INSTALL_UNITDIR) + @$(ECHO) Install source dir... $(INSTALL_SOURCEDIR) + @$(ECHO) Install doc dir...... $(INSTALL_DOCDIR) + @$(ECHO) Install example dir.. $(INSTALL_EXAMPLEDIR) + @$(ECHO) Install data dir..... $(INSTALL_DATADIR) + @$(ECHO) + @$(ECHO) Dist destination dir. $(DIST_DESTDIR) + @$(ECHO) Dist zip name........ $(DIST_ZIPNAME) + @$(ECHO) +.PHONY: fpc_info +fpc_info: $(INFORULES) +.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \ + fpc_makefile_dirs +fpc_makefile: + $(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc +fpc_makefile_sub1: +ifdef TARGET_DIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS)) +endif +ifdef TARGET_EXAMPLEDIRS + $(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS)) +endif +fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS)) +fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2 +fpc_makefiles: fpc_makefile fpc_makefile_dirs +all: fpc_all +debug: fpc_debug +smart: fpc_smart +release: fpc_release +units: fpc_units +examples: +shared: fpc_shared +install: fpc_install +sourceinstall: fpc_sourceinstall +exampleinstall: fpc_exampleinstall +distinstall: fpc_distinstall +zipinstall: fpc_zipinstall +zipsourceinstall: fpc_zipsourceinstall +zipexampleinstall: fpc_zipexampleinstall +zipdistinstall: fpc_zipdistinstall +clean: fpc_clean +distclean: fpc_distclean +cleanall: fpc_cleanall +info: fpc_info +makefiles: fpc_makefiles +.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif +fpgui$(PPUEXT): $(wildcard *.pp *.inc) diff --git a/gui/Makefile.fpc b/gui/Makefile.fpc new file mode 100644 index 00000000..c3c7f032 --- /dev/null +++ b/gui/Makefile.fpc @@ -0,0 +1,41 @@ +# +# Makefile.fpc for fpGUI +# + +[package] +name=fpgui +version=0.3 + +[require] +packages=fcl fpgfx + +[target] +units=fpgui stylemanager +#dirs=db + +#[dirs] +#incdir=defimpl +#incdir_win32=win32 + +[compiler] +unittargetdir=units +#targetdir=. +options=-S2h +includedir_linux=defimpl +includedir_freebsd=defimpl +includedir_netbsd=defimpl +includedir_win32=win32 + +[install] +#buildunit=fpgui +fpcpackage=y + +[default] +fpcdir=/opt/fpc/src + +[rules] +fpgui$(PPUEXT): $(wildcard *.pas *.inc) + +[libs] +libname=libfpgui.so +libversion=0.3 diff --git a/gui/application.inc b/gui/application.inc new file mode 100644 index 00000000..c431e69f --- /dev/null +++ b/gui/application.inc @@ -0,0 +1,206 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Application class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + { Application class declarations } + + { TApplication } + + TApplication = class(TDefApplication) + private +// FDisplay: TGfxDisplay; +// FDisplayName: String; +// FForms: TList; + FUserStyle: TStyle; +// function GetDisplay: TGfxDisplay; +// procedure SetDisplayName(const AValue: String); + protected + FDefaultStyle: TStyle; + FTitle: String; + XMLDoc: TXMLDocument; + function GetDefaultStyle: TStyle; + procedure SetTitle(const ATitle: String); + public +// constructor Create; reintroduce; + destructor Destroy; override; + procedure SetupXMLStreaming(const AXMLFilename: String); +// procedure CreateForm(InstanceClass: TComponentClass; var Reference); +// procedure AddForm(AForm: TCustomForm); +// procedure Run; + procedure SetStyle(pNewStyle: TStyle); +// property Display: TGfxDisplay read GetDisplay; +// property DisplayName: String read FDisplayName write SetDisplayName; + property DefaultStyle: TStyle read GetDefaultStyle; + property Title: String read FTitle write SetTitle; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +// =================================================================== +// TApplication +// =================================================================== +{ +constructor TApplication.Create; +begin + inherited Create(nil); + FForms := TList.Create; +end; +} + +destructor TApplication.Destroy; +begin + FUserStyle := nil; +// FForms.Free; + // !!!: Only auto-created styles should be destroyed, not user-provided + if Assigned(FDefaultStyle) then + FDefaultStyle.Free; +// if Assigned(FDisplay) then +// FDisplay.Free; + inherited Destroy; +end; + + +procedure TApplication.SetupXMLStreaming(const AXMLFilename: String); +begin + ReadXMLFile(XMLDoc, AXMLFilename); +end; + +{ +procedure TApplication.CreateForm(InstanceClass: TComponentClass; var Reference); +type + PForm = ^TCustomForm; +var + form: PForm; + Filename: String; + TextStream, BinStream: TStream; +begin + form := @Reference; + form^ := TCustomForm(InstanceClass.Create(Self)); + + Filename := LowerCase(Copy(InstanceClass.ClassName, 2, 255)) + '.frm'; + + TextStream := TFileStream.Create(Filename, fmOpenRead); + BinStream := TMemoryStream.Create; + ObjectTextToBinary(TextStream, BinStream); + TextStream.Free; + + BinStream.Position := 0; + BinStream.ReadComponent(Form^); + BinStream.Free; + + Form^.Show; +end; +} +{ +procedure TApplication.AddForm(AForm: TCustomForm); +begin + FForms.Add(AForm); + AForm.Show; +end; +} +{ +procedure TApplication.Run; +begin + Display.Run; +end; +} + +procedure TApplication.SetStyle(pNewStyle: TStyle); +begin + if Assigned(FUserStyle) then + FUserStyle.Free; + FUserStyle := pNewStyle; +end; +{ +function TApplication.GetDisplay: TGfxDisplay; +begin + if FDisplay = nil then FDisplay := TDefDisplay.Create(FDisplayName); + Result := FDisplay; +end; +} +{ +procedure TApplication.SetDisplayName(const AValue: String); +begin + // The display name cannot be changed after we have created it. + if (FDisplayName=AValue) or (FDisplay<>nil) then exit; + FDisplayName:=AValue; +end; +} +function TApplication.GetDefaultStyle: TStyle; +begin + if Assigned(FUserStyle) then + Result := FUserStyle + else + begin + if not Assigned(FDefaultStyle) then + FDefaultStyle := TDefaultStyle.Create(self); + Result := FDefaultStyle; + end; +end; + + +procedure TApplication.SetTitle(const ATitle: String); +begin + if ATitle <> FTitle then + begin + FTitle := ATitle; + // !!!: Change title of all forms with Text='' to FTitle + end; +end; + + +{!!!: Remove this ASAP +function TApplication.XMLReadFormProc(Instance: TComponent): Boolean; +var + Node: TDOMNode; + Reader: TXMLStreamingReader; +begin + Result := False; + if not Assigned(XMLDoc) then + exit; + Node := XMLDoc.DocumentElement.FirstChild; + + // Search the correct serialisation node + while True do + begin + if not Assigned(Node) then + exit; + if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'component') and + (UpperCase(TDOMElement(Node).GetAttribute('class')) = Instance.ClassName) then + break; + Node := Node.NextSibling; + end; + Reader := TXMLStreamingReader.Create(Node as TDOMElement); + try + Reader.ReadRootComponent(Instance); + finally + Reader.Free; + end; + Result := True; +end;} + +{$ENDIF read_implementation} + diff --git a/gui/bin.inc b/gui/bin.inc new file mode 100644 index 00000000..55ba3f8f --- /dev/null +++ b/gui/bin.inc @@ -0,0 +1,114 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Bin widget declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + { Bin widget declarations } + TBinWidget = class(TContainerWidget) + protected + FChild: TWidget; + procedure SetChild(AChild: TWidget); + function GetChildCount: Integer; override; + function GetChild(Index: Integer): TWidget; override; + procedure CalcSizes; override; + public // !!!: temporarily + property Child: TWidget read FChild write SetChild; + // really public :) + function ContainsChild(AChild: TWidget): Boolean; override; + procedure InsertChild(AChild: TWidget); override; + procedure RemoveChild(AChild: TWidget); override; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + + +// =================================================================== +// TBinWidget +// =================================================================== + +function TBinWidget.ContainsChild(AChild: TWidget): Boolean; +begin + Result := Assigned(AChild) and (FChild = AChild); +end; + + +procedure TBinWidget.InsertChild(AChild: TWidget); +begin + if FChild <> AChild then + begin + if Assigned(FChild) then + FChild.Parent := nil; + FChild := AChild; + FChild.Parent := Self; + end; +end; + + +procedure TBinWidget.RemoveChild(AChild: TWidget); +begin + if FChild = AChild then + begin + FChild := nil; + AChild.Parent := nil; + end; +end; + + +function TBinWidget.GetChildCount: Integer; +begin + Result := Ord(Assigned(Child)); +end; + + +function TBinWidget.GetChild(Index: Integer): TWidget; +begin + if (Index = 0) and Assigned(Child) then + Result := Child + else + TList.Error(SListIndexError, Index); +end; + + +procedure TBinWidget.CalcSizes; +begin + LAYOUTTRACE('TBinWidget.CalcSizes for %s:%s', [Name, ClassName]); + if Assigned(Child) then + begin + FMinSize := Child.MinSize; + FMaxSize := Child.MaxSize; + FDefSize := Child.DefSize; + end; +end; + + +procedure TBinWidget.SetChild(AChild: TWidget); +begin + InsertChild(AChild); +end; + + +{$ENDIF read_implementation} + diff --git a/gui/buttons.inc b/gui/buttons.inc new file mode 100644 index 00000000..4ae69f5d --- /dev/null +++ b/gui/buttons.inc @@ -0,0 +1,154 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Button class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + + +{$IFDEF read_interface} + + TGenericButton = class(TWidget) + protected + FEmbedded: Boolean; + procedure Paint(Canvas: TFCanvas); override; + public + constructor Create(AOwner: TComponent); override; + property Embedded: Boolean read FEmbedded write FEmbedded default False; + end; + + + TCustomButton = class(TGenericButton) + protected + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + public + constructor Create(const pText: string; pOwner: TComponent); overload; + end; + + + TButton = class(TCustomButton) + published + property CanExpandWidth; + property Enabled; + property Text; + property OnClick; + end; + +{ + TCustomImageButton = class(TGenericButton) + protected + procedure Paint(Canvas: TGfxCanvas); override; + procedure EvRecalcLayout; override; + end; + + TImageButton = class(TCustomImageButton) + published + property Enabled; + property Image; + property OnClick; + end; +} + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +// =================================================================== +// TGenericButton +// =================================================================== + +constructor TGenericButton.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WidgetStyle := WidgetStyle + [wsCaptureMouse, wsClickable, wsOpaque]; +end; + + +procedure TGenericButton.Paint(Canvas: TFCanvas); +var + Flags: TButtonFlags; +begin + if Embedded then + Flags := [btnIsEmbedded] + else + Flags := []; + if (wsClicked in WidgetState) and (wsMouseInside in WidgetState) then + Include(Flags, btnIsPressed); + if (wsHasFocus in WidgetState) and not Embedded then + begin + Include(Flags, btnIsSelected); + if FindForm.IsActive then + Include(Flags, btnHasFocus); + end; + + Style.DrawButtonFace(Canvas, Rect(0, 0, BoundsSize.cx, BoundsSize.cy), Flags); +end; + + +// =================================================================== +// TCustomButton +// =================================================================== + +procedure TCustomButton.Paint(Canvas: TFCanvas); +var + Pt: TPoint; + Borders: TRect; +begin + inherited Paint(Canvas); + + Borders := Style.GetButtonBorders; + Canvas.IntersectClipRect(Rect(Borders.Left, Borders.Top, + BoundsSize.cx - Borders.Right, BoundsSize.cy - Borders.Bottom)); + + Canvas.SetColor(Style.GetUIColor(clBtnText)); + Pt.x := (BoundsSize.cx - Canvas.TextWidth(Text)) div 2; + Pt.y := (BoundsSize.cy - Canvas.FontCellHeight) div 2; + if (wsClicked in WidgetState) and (wsMouseInside in WidgetState) then + Pt := Pt + Point(1, 1); + Style.DrawText(Canvas, Pt, Text, WidgetState); +end; + + +procedure TCustomButton.CalcSizes; +var + Borders: TRect; +begin + LAYOUTTRACE('TCustomButton.CalcSizes for %s:%s', [Name, ClassName]); + Borders := Style.GetButtonBorders; + with FindForm.Wnd.Canvas do + begin + FMinSize.cx := Borders.Left + Borders.Right + TextWidth(Text); + if FMinSize.cx < 75 then + FMinSize.cx := 75; // apply default button width + FMinSize.cy := Borders.Left + Borders.Right + FontCellHeight; + end; + FDefSize := FMinSize + gfxbase.Size(20, 2); +end; + + +constructor TCustomButton.Create(const pText: string; pOwner: TComponent); +begin + Create(pOwner); + Text := pText; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/checkbox.inc b/gui/checkbox.inc new file mode 100644 index 00000000..5cd8d314 --- /dev/null +++ b/gui/checkbox.inc @@ -0,0 +1,130 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Checkbox class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + { TCustomCheckbox } + + TCustomCheckbox = class(TWidget) + private + procedure SetChecked(AChecked: Boolean); + protected + FChecked: Boolean; + FLabelPos: TPoint; + procedure Click; override; + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + property Checked: Boolean read FChecked write SetChecked; + public + constructor Create(AOwner: TComponent); override; + constructor Create(const pText: string; pOwner: TComponent); overload; + end; + + + TCheckbox = class(TCustomCheckbox) + published + property Enabled; + property CanExpandHeight; + property CanExpandWidth; + property Checked; + property Text; + property OnClick; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +// =================================================================== +// TCustomCheckBox +// =================================================================== + +constructor TCustomCheckBox.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WidgetStyle := WidgetStyle + [wsCaptureMouse, wsClickable, wsOpaque]; +end; + + +constructor TCustomCheckbox.Create(const pText: string; pOwner: TComponent); +begin + Create(pOwner); + Text := pText; +end; + + +procedure TCustomCheckBox.Click; +begin + FChecked := not FChecked; + inherited Click; +end; + + +procedure TCustomCheckBox.Paint(Canvas: TFCanvas); +var + FontHeight: Integer; + LabelRect: TRect; + Flags: TCheckboxFlags; +begin + FontHeight := Canvas.FontCellHeight; + LabelRect.Left := FLabelPos.x; + LabelRect.Top := FLabelPos.y + (Height - MinSize.cy) div 2; + LabelRect.Right := LabelRect.Left + Canvas.TextWidth(Text); + LabelRect.Bottom := LabelRect.Top + FontHeight; + + Flags := []; + if (wsClicked in WidgetState) and (wsMouseInside in WidgetState) then + Include(Flags, cbIsPressed); + if (wsHasFocus in WidgetState) and FindForm.IsActive then + Include(Flags, cbHasFocus); + if wsEnabled in WidgetState then + Include(Flags, cbIsEnabled); + if Checked then + Include(Flags, cbIsChecked); + + Style.DrawCheckbox(Canvas, Rect(0, 0, Width, Height), LabelRect, Flags); + Canvas.SetColor(Style.GetUIColor(clWindowText)); + Style.DrawText(Canvas, LabelRect.TopLeft, Text, WidgetState); +end; + + +procedure TCustomCheckBox.CalcSizes; +begin + with FindForm.Wnd.Canvas do + Style.GetCheckBoxLayout(gfxbase.Size(TextWidth(Text), FontCellHeight), + FMinSize, FLabelPos); +end; + + +procedure TCustomCheckBox.SetChecked(AChecked: Boolean); +begin + if AChecked <> Checked then + begin + FChecked := AChecked; + Redraw; + end; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/colors.inc b/gui/colors.inc new file mode 100644 index 00000000..e83432b1 --- /dev/null +++ b/gui/colors.inc @@ -0,0 +1,222 @@ + + { NOTE: + The colors commented out below are not applicable to systems other than + Windows. For this reason I don't see the need to define them. Under Linux, + the Windows Manager theme will draw those parts anyway and we have no + control over that or the colors used. } + + // UI element colors + clScrollBar = TColor($80000000); +// clBackground = TColor($80000001); +// clActiveCaption = TColor($80000002); +// clInactiveCaption = TColor($80000003); + clMenu = TColor($80000004); + clWindow = TColor($80000005); +// clWindowFrame = TColor($80000006); + clMenuText = TColor($80000007); + clWindowText = TColor($80000008); +// clCaptionText = TColor($80000009); +// clActiveBorder = TColor($8000000a); +// clInactiveBorder = TColor($8000000b); + clAppWorkSpace = TColor($8000000c); + clHighlight = TColor($8000000d); + clHighlightText = TColor($8000000e); + cl3DFace = TColor($8000000f); + cl3DShadow = TColor($80000010); + clGrayText = TColor($80000011); + clBtnText = TColor($80000012); +// clInactiveCaptionText = TColor($80000013); + cl3DHighlight = TColor($80000014); + cl3DDkShadow = TColor($80000015); + cl3DLight = TColor($80000016); + clInfoText = TColor($80000017); + clInfoBk = TColor($80000018); + + // The following colors match the predefined Delphi Colors + clBlack = TColor($000000); + clMaroon = TColor($000080); + clGreen = TColor($008000); + clOlive = TColor($008080); + clNavy = TColor($800000); + clPurple = TColor($800080); + clTeal = TColor($808000); + clGray = TColor($808080); + clSilver = TColor($C0C0C0); + clRed = TColor($0000FF); + clLime = TColor($00FF00); + clYellow = TColor($00FFFF); + clBlue = TColor($FF0000); + clFuchsia = TColor($FF00FF); + clAqua = TColor($FFFF00); + clLtGray = TColor($C0C0C0); + clDkGray = TColor($808080); + clWhite = TColor($FFFFFF); + clCream = TColor($F0FBFF); + clMoneyGreen = TColor($C0DCC0); + clSkyBlue = TColor($F0CAA6); +// clNone = TColor($1FFFFFFF); +// clDefault = TColor($20000000); + + // alias color names + clBtnFace = cl3DFace; + clBtnShadow = cl3DShadow; + clBtnHighlight = cl3DHighlight; + clCyan = clAqua; + clMagenta = clFuchsia; + + // web/html named colors - De-facto NS & MSIE recognized HTML color names + clAliceBlue = TColor($FFF8F0); + clAntiqueWhite = TColor($D7EBFA); +// clAqua = TColor($FFFF00); + clAquamarine = TColor($D4FF7F); + clAzure = TColor($FFFFF0); + clBeige = TColor($DCF5F5); + clBisque = TColor($C4E4FF); +// clBlack = TColor($000000); + clBlanchedAlmond = TColor($CDEBFF); +// clBlue #0000ff + clBlueViolet = TColor($E22B8A); + clBrown = TColor($2A2AA5); + clBurlyWood = TColor($87B8DE); + clCadetBlue = TColor($A09E5F); + clChartreuse = TColor($00FF7F); + clChocolate = TColor($1E69D2); + + + clMedGray = TColor($A4A0A0); + clForestGreen = TColor($228B22); + clRoyalBlue = TColor($E16941); + clLightYellow = TColor($E0FFFF); + clCornsilk = TColor($DCF8FF); + clMidnightBlue = TColor($701919); + clDarkWhite = TColor($E0E0E0); + +{ +# De-facto NS & MSIE recognized HTML color names +Coral #ff7f50 +CornflowerBlue #6495ed +Cornsilk #fff8dc +Crimson #dc143c +Cyan #00ffff +DarkBlue #00008b +DarkCyan #008b8b +DarkGoldenrod #b8860b +DarkGray #a9a9a9 +DarkGreen #006400 +DarkKhaki #bdb76b +DarkMagenta #8b008b +DarkOliveGreen #556b2f +DarkOrange #ff8c00 +DarkOrchid #9932cc +DarkRed #8b0000 +DarkSalmon #e9967a +DarkSeaGreen #8fbc8f +DarkSlateBlue #483d8b +DarkSlateGray #2f4f4f +DarkTurquoise #00ced1 +DarkViolet #9400d3 +DeepPink #ff1493 +DeepSkyBlue #00bfff +DimGray #696969 +DodgerBlue #1e90ff +FireBrick #b22222 +FloralWhite #fffaf0 +ForestGreen #228b22 +Fuchsia #ff00ff +Gainsboro #dcdcdc +GhostWhite #f8f8ff +Gold #ffd700 +Goldenrod #daa520 +Gray #808080 +Green #008000 +GreenYellow #adff2f +Honeydew #f0fff0 +HotPink #ff69b4 +IndianRed #cd5c5c +Indigo #4b0082 +Ivory #fffff0 +Khaki #f0e68c +Lavender #e6e6fa +LavenderBlush #fff0f5 +LawnGreen #7cfc00 +LemonChiffon #fffacd +LightBlue #add8e6 +LightCoral #f08080 +LightCyan #e0ffff +LightGoldenrodYellow #fafad2 +LightGreen #90ee90 +LightGrey #d3d3d3 +LightPink #ffb6c1 +LightSalmon #ffa07a +LightSeaGreen #20b2aa +LightSkyBlue #87cefa +LightSlateGray #778899 +LightSteelBlue #b0c4de +LightYellow #ffffe0 +Lime #00ff00 +LimeGreen #32cd32 +Linen #faf0e6 +Magenta #ff00ff +Maroon #800000 +MediumAquamarine #66cdaa +MediumBlue #0000cd +MediumOrchid #ba55d3 +MediumPurple #9370db +MediumSeaGreen #3cb371 +MediumSlateBlue #7b68ee +MediumSpringGreen #00fa9a +MediumTurquoise #48d1cc +MediumVioletRed #c71585 +MidnightBlue #191970 +MintCream #f5fffa +MistyRose #ffe4e1 +Moccasin #ffe4b5 +NavajoWhite #ffdead +Navy #000080 +OldLace #fdf5e6 +Olive #808000 +OliveDrab #6b8e23 +Orange #ffa500 +OrangeRed #ff4500 +Orchid #da70d6 +PaleGoldenrod #eee8aa +PaleGreen #98fb98 +PaleTurquoise #afeeee +PaleVioletRed #db7093 +PapayaWhip #ffefd5 +PeachPuff #ffdab9 +Peru #cd853f +Pink #ffc0cb +Plum #dda0dd +PowderBlue #b0e0e6 +Purple #800080 +Red #ff0000 +RosyBrown #bc8f8f +RoyalBlue #4169e1 +SaddleBrown #8b4513 +Salmon #fa8072 +SandyBrown #f4a460 +SeaGreen #2e8b57 +Seashell #fff5ee +Sienna #a0522d +Silver #c0c0c0 +SkyBlue #87ceeb +SlateBlue #6a5acd +SlateGray #708090 +Snow #fffafa +SpringGreen #00ff7f +SteelBlue #4682b4 +Tan #d2b48c +Teal #008080 +Thistle #d8bfd8 +Tomato #ff6347 +Turquoise #40e0d0 +Violet #ee82ee +Wheat #f5deb3 +White #ffffff +WhiteSmoke #f5f5f5 +Yellow #ffff00 +YellowGreen #9acd32 +} + + diff --git a/gui/combobox.inc b/gui/combobox.inc new file mode 100644 index 00000000..33774b93 --- /dev/null +++ b/gui/combobox.inc @@ -0,0 +1,288 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Combobox class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + { Combobox widget declarations } + + { TCustomComboBox } + + TComboBoxPopup = class(TPopupWindow) + private + FListBox: TListBox; + procedure ItemSelected(Sender: TObject); + public + constructor Create(AOwner: TComponent); override; + property ListBox: TListBox read FListBox; + end; + + + TCustomComboBox = class(TWidget) + private + FItemIndex: Integer; + FItems: TStrings; + FOnChange: TNotifyEvent; + procedure ButtonClick(Sender: TObject); + procedure DropDownDeactivate(Sender: TObject); + procedure DropDownDestroy(Sender: TObject); + procedure SetItemIndex(const AValue: Integer); + protected + FButton: TGenericButton; +// FDropDown: TCustomForm; + FDropDown: TComboBoxPopup; + lbl: TLabel; + procedure Click; override; + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + procedure Resized; override; + function DistributeEvent(Event: TEventObj): Boolean; override; + property CanExpandWidth default True; +// property DropDownCount: integer read FDropDownCount write FDropDownCount; + property ItemIndex: Integer read FItemIndex write SetItemIndex default -1; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property Items: TStrings read FItems write FItems; + end; + + + TComboBox = class(TCustomComboBox) + published + property CanExpandWidth; + property CanExpandHeight; + property Enabled; + property Text; + property ItemIndex; + property OnChange; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + +{ Combobox widget implementation } + +type + TArrowButton = class(TGenericButton) + protected + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + end; + + +procedure TArrowButton.Paint(Canvas: TFCanvas); +begin + inherited Paint(Canvas); + Style.DrawComboBoxArrow(Canvas, Rect(0, 0, Width, Height), + (wsClicked in WidgetState) and (wsMouseInside in WidgetState), + wsEnabled in WidgetState); +end; + + +procedure TArrowButton.CalcSizes; +begin + FMinSize := Style.GetComboBoxArrowSize; +end; + + +procedure TComboBoxPopup.ItemSelected(Sender: TObject); +begin + Close; +end; + + +constructor TComboBoxPopup.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WidgetStyle := WidgetStyle + [wsCaptureMouse, wsClickable, wsOpaque]; + + FListBox := TListBox.Create(self); + FListBox.Name := 'listbox'; + FListBox.Parent := self; + FListBox.HotTrack := True; +// FListBox.OnClick := @ItemSelected; // Listbox needs OnSelect event +end; + + +// ------------------------------------------------------------------- +// TCustomComboBox +// ------------------------------------------------------------------- + +constructor TCustomComboBox.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FCanExpandWidth := True; + WidgetStyle := WidgetStyle + [wsCaptureMouse, wsClickable, wsOpaque]; + FItems := TStringList.Create; + FItemIndex := -1; + + FButton := TArrowButton.Create(Self); + FButton.Name := 'FButton'; + FButton.Embedded := True; + FButton.CanExpandWidth := False; + FButton.OnClick := @ButtonClick; + FButton.Parent := Self; +end; + + +destructor TCustomComboBox.Destroy; +begin + FDropDown.Free; + inherited Destroy; +end; + + +procedure TCustomComboBox.Paint(Canvas: TFCanvas); +var + Pt: TPoint; + ItemRect: TRect; + ItemFlags: TItemFlags; +begin + ItemFlags := []; + Style.DrawEditBox(Canvas, Rect(0, 0, Width, Height)); + + if Text <> '' then + begin + Style.SetUIColor(Canvas, clWindowText); + Pt.x := 4; + Pt.y := (BoundsSize.cy - Canvas.FontCellHeight) div 2; + + if (wsHasFocus in WidgetState) and FindForm.IsActive then + begin + Include(ItemFlags, ifFocused); + Include(ItemFlags, ifSelected); + end; + + ItemRect := Rect(0, 0, (Width - FButton.Width), Height); +// InflateRect(ItemRect, -1, -1); + ItemRect.TopLeft := ItemRect.TopLeft + 1; + ItemRect.BottomRight := ItemRect.BottomRight - 2; + + Style.DrawItemBefore(Canvas, ItemRect, ItemFlags); + Style.DrawText(Canvas, Pt, Text, WidgetState); + Style.DrawItemAfter(Canvas, ItemRect, ItemFlags); + end + else + begin + if (wsHasFocus in WidgetState) and FindForm.IsActive then + Style.DrawFocusRect(Canvas, Rect(0, 0, Width, Height)); + end; +end; + + +procedure TCustomComboBox.CalcSizes; +begin + with Style.GetEditBoxBorders do + FMinSize := gfxBase.Size(FButton.MinSize.cx, + Max(FindForm.Wnd.Canvas.FontCellHeight, FButton.MinSize.cy)) + + TopLeft + BottomRight; +end; + + +procedure TCustomComboBox.Resized; +begin + with Style.GetEditBoxBorders do + FButton.SetBounds(Point(Width - Right - FButton.MinSize.cx, Top), + FButton.MinSize); +end; + + +function TCustomComboBox.DistributeEvent(Event: TEventObj): Boolean; +begin + Result := Event.SendToChild(FButton) or + inherited DistributeEvent(Event); +end; + + +procedure TCustomComboBox.ButtonClick(Sender: TObject); +var + l: TCustomListBox; +begin + if Assigned(FDropDown) and FDropDown.Visible then + begin + FDropDown.Close; + Exit; //==> + end; + + if not Assigned(FDropDown) then + begin + FDropDown := TComboBoxPopup.Create(Self); + FDropDown.OnDeactivate := @DropDownDeactivate; + FDropDown.OnDestroy := @DropDownDestroy; + FDropDown.ListBox.Items.Text := FItems.Text; + FDropDown.ListBox.FItemIndex := FItemIndex; + FDropDown.ListBox.OnClick := @DropDownDeactivate; + end; + + FDropDown.SetPosition(ClientToScreen(Point(0, Height))); + FDropDown.Show; +end; + + +procedure TCustomComboBox.DropDownDeactivate(Sender: TObject); +begin + LAYOUTTRACE('TCustomComboBox.DropDownDestroy for %s:%s', [Name, ClassName]); + ItemIndex := FDropDown.ListBox.ItemIndex; + FDropDown.Close; + SetFocus; +end; + + +procedure TCustomComboBox.DropDownDestroy(Sender: TObject); +begin + LAYOUTTRACE('TCustomComboBox.DropDownDestroy for %s:%s', [Name, ClassName]); + FDropDown := nil; +end; + + +procedure TCustomComboBox.SetItemIndex(const AValue: Integer); +begin + if FItemIndex <> AValue then + begin + if AValue < FItems.Count then + FItemIndex := AValue; + if FItemIndex = -1 then + Text := '' + else + Text := FItems[FItemIndex]; + + // fire event + if Assigned(OnChange) then + OnChange(Self); + end; +end; + + +{ This event causes the combobox to drop open when you click anywhere in the + component, or press the spacebar key. } +procedure TCustomComboBox.Click; +begin + ButtonClick(nil); + inherited Click; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/container.inc b/gui/container.inc new file mode 100644 index 00000000..fe129f1c --- /dev/null +++ b/gui/container.inc @@ -0,0 +1,91 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Container class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + { Container widget declarations } + + TContainerWidget = class(TWidget) + protected + function DistributeEvent(Event: TEventObj): Boolean; override; + function GetChildCount: Integer; virtual; abstract; + function GetChild(Index: Integer): TWidget; virtual; abstract; + property ChildCount: Integer read GetChildCount; + property Children[Index: Integer]: TWidget read GetChild; + // Move to public in decendant classes, if you want them visible + procedure InsertChild(AChild: TWidget); dynamic; virtual; + procedure RemoveChild(AChild: TWidget); dynamic; virtual; + public + function GetChildAt(APoint: TPoint): TWidget; + function ContainsChild(AChild: TWidget): Boolean; dynamic; abstract; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +// =================================================================== +// TContainerWidget +// =================================================================== + +function TContainerWidget.GetChildAt(APoint: TPoint): TWidget; +var + i: Integer; +begin + for i := 0 to ChildCount - 1 do + begin + Result := Children[i]; + if PtInRect(Result.BoundsRect, APoint) then + exit; + end; + Result := nil; +end; + +function TContainerWidget.DistributeEvent(Event: TEventObj): Boolean; +var + i: Integer; +begin + // Propagate the event to all children + for i := 0 to ChildCount - 1 do + if Event.SendToChild(Children[i]) then + begin + Result := True; + exit; + end; + // The event hasn't been processed by any child: + Result := inherited DistributeEvent(Event); +end; + +procedure TContainerWidget.InsertChild(AChild: TWidget); +begin + // do nothing +end; + +procedure TContainerWidget.RemoveChild(AChild: TWidget); +begin + // do nothing +end; + + +{$ENDIF read_implementation} + diff --git a/gui/db/Makefile b/gui/db/Makefile new file mode 100644 index 00000000..5485f240 --- /dev/null +++ b/gui/db/Makefile @@ -0,0 +1,1373 @@ +# +# Makefile generated by fpcmake v1.00 [2000/12/25] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT or OS/2) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +# define inOS2 when running under OS/2 +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +PWD:=$(firstword $(PWD)) +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The extension of batch files / scripts +ifdef inUnix +BATCHEXT=.sh +else +ifdef inOS2 +BATCHEXT=.cmd +else +BATCHEXT=.bat +endif +endif + +# Path Separator, the subst trick is necessary for the \ that can't exists +# at the end of a line +ifdef inUnix +PATHSEP=/ +else +PATHSEP=$(subst /,\,/) +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Default FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR=../../../.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override UNITOBJECTS+=fpgui_db + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2h + +# Directories + +override NEEDUNITDIR=.. + +# Packages + +override PACKAGES+=rtl fcl fpgfx fpgui + +# Libraries + + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +PPAS=ppas$(BATCHEXT) + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 +PACKAGEFCL=1 +PACKAGEFPGFX=1 +PACKAGEFPGUI=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef PACKAGEFCL +ifneq ($(wildcard $(FPCDIR)/fcl),) +ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),) +PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET) +else +PACKAGEDIR_FCL=$(FPCDIR)/fcl +endif +ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fcl +package_fcl: + $(MAKE) -C $(PACKAGEDIR_FCL) all +endif +UNITDIR_FCL=$(PACKAGEDIR_FCL) +else +PACKAGEDIR_FCL= +ifneq ($(wildcard $(UNITSDIR)/fcl),) +ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),) +UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET) +else +UNITDIR_FCL=$(UNITSDIR)/fcl +endif +else +UNITDIR_FCL= +endif +endif +ifdef UNITDIR_FCL +override NEEDUNITDIR+=$(UNITDIR_FCL) +endif +endif +ifdef PACKAGEFPGFX +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx/$(OS_TARGET)),) +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx/$(OS_TARGET) +else +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +else +PACKAGEDIR_FPGFX= +ifneq ($(wildcard $(UNITSDIR)/fpgfx),) +ifneq ($(wildcard $(UNITSDIR)/fpgfx/$(OS_TARGET)),) +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx/$(OS_TARGET) +else +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx +endif +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override NEEDUNITDIR+=$(UNITDIR_FPGFX) +endif +endif +ifdef PACKAGEFPGUI +ifneq ($(wildcard $(PACKAGESDIR)/fpgui),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgui/$(OS_TARGET)),) +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui/$(OS_TARGET) +else +PACKAGEDIR_FPGUI=$(PACKAGESDIR)/fpgui +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGUI)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgui +package_fpgui: + $(MAKE) -C $(PACKAGEDIR_FPGUI) all +endif +UNITDIR_FPGUI=$(PACKAGEDIR_FPGUI) +else +PACKAGEDIR_FPGUI= +ifneq ($(wildcard $(UNITSDIR)/fpgui),) +ifneq ($(wildcard $(UNITSDIR)/fpgui/$(OS_TARGET)),) +UNITDIR_FPGUI=$(UNITSDIR)/fpgui/$(OS_TARGET) +else +UNITDIR_FPGUI=$(UNITSDIR)/fpgui +endif +else +UNITDIR_FPGUI= +endif +endif +ifdef UNITDIR_FPGUI +override NEEDUNITDIR+=$(UNITDIR_FPGUI) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Units +##################################################################### + +.PHONY: fpc_units + +override ALLTARGET+=fpc_units + +override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS)) +override INSTALLPPUFILES+=$(UNITPPUFILES) +override CLEANPPUFILES+=$(UNITPPUFILES) + +fpc_units: $(UNITPPUFILES) + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +PACKAGESUFFIX=emx +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +# Use a wrapper script by default for OS/2 +ifdef inOS2 +USEZIPWRAPPER=1 +endif + +# Create commands to create the zip/tar file +ZIPWRAPPER=$(DESTZIPDIR)/fpczip$(BATCHEXT) +ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR)) +ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR)) +ifdef USETAR +ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) +ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) * +else +ZIPDESTFILE:=$(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) +ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) * +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) + $(DEL) $(ZIPDESTFILE) +ifdef USEZIPWRAPPER +ifneq ($(ECHO),echo) + $(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER) + $(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER) + $(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER) +else + $(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER) + $(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER) + $(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER) +endif +ifdef inUnix + /bin/sh $(ZIPWRAPPER) +else + $(ZIPWRAPPER) +endif + $(DEL) $(ZIPWRAPPER) +else + $(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/gui/db/Makefile.fpc b/gui/db/Makefile.fpc new file mode 100644 index 00000000..144acce4 --- /dev/null +++ b/gui/db/Makefile.fpc @@ -0,0 +1,20 @@ +# +# Makefile.fpc for fpGUI database support +# + +[targets] +units=fpgui_db + +[require] +options=-S2h +packages=fcl fpgfx fpgui + +#[libs] +#libname=fpgui + +[install] +subdir= + +[dirs] +fpcdir=../../../.. +unitdir=.. diff --git a/gui/db/fpgui_db.pas b/gui/db/fpgui_db.pas new file mode 100644 index 00000000..10f0e5a6 --- /dev/null +++ b/gui/db/fpgui_db.pas @@ -0,0 +1,167 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + fgGUI database support + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +unit fpGUI_DB; + +{$IFDEF Debug} +{$ASSERTIONS On} +{$ENDIF} + +interface + +uses Classes, fpGUI, DB; + +type + TFieldDataLink = class(TDataLink) + private + FWidget: TWidget; + FField: TField; + FFieldName: String; + FOnDataChange: TNotifyEvent; + procedure SetFieldName(const AFieldName: String); + procedure UpdateField; + protected + procedure ActiveChanged; override; + procedure RecordChanged(AField: TField); override; + public + constructor Create(AWidget: TWidget); + property Field: TField read FField; + property FieldName: String read FFieldName write SetFieldName; + property OnDataChange: TNotifyEvent read FOnDataChange write FOnDataChange; + end; + + TDBText = class(TCustomLabel) + private + FDataLink: TFieldDataLink; + function GetDataField: String; + procedure SetDataField(const ADataField: String); + function GetDataSource: TDataSource; + procedure SetDataSource(ADataSource: TDataSource); + procedure DataChange(Sender: TObject); + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + property Text; + property DataField: String read GetDataField write SetDataField; + property DataSource: TDataSource read GetDataSource write SetDataSource; + end; + + +// =================================================================== +// =================================================================== + +implementation + + +constructor TFieldDataLink.Create(AWidget: TWidget); +begin + inherited Create; + FWidget := AWidget; +end; + +procedure TFieldDataLink.ActiveChanged; +begin + UpdateField; +end; + +procedure TFieldDataLink.RecordChanged(AField: TField); +begin + if Assigned(OnDataChange) then + OnDataChange(Self); +end; + +procedure TFieldDataLink.SetFieldName(const AFieldName: String); +begin + if AFieldName <> FieldName then + begin + FFieldName := AFieldName; + UpdateField; + end; +end; + +procedure TFieldDataLink.UpdateField; +begin +WriteLn('##############UpdateField. DataSet: ', DataSource.DataSet.ClassName); + FField := DataSource.DataSet.FindField(FieldName); + if Assigned(OnDataChange) then + OnDataChange(Self); +end; + + +constructor TDBText.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FDataLink := TFieldDataLink.Create(Self); + FDataLink.OnDataChange := @DataChange; +end; + +destructor TDBText.Destroy; +begin + FDataLink.Free; + inherited Destroy; +end; + +function TDBText.GetDataField: String; +begin + Result := FDataLink.FieldName; +end; + +procedure TDBText.SetDataField(const ADataField: String); +begin + FDataLink.FieldName := ADataField; +end; + +function TDBText.GetDataSource: TDataSource; +begin + Result := FDataLink.DataSource; +end; + +procedure TDBText.SetDataSource(ADataSource: TDataSource); +begin + FDataLink.DataSource := ADataSource; +end; + +procedure TDBText.DataChange(Sender: TObject); +begin +Write('TDBText.DataChange'); + if Assigned(FDataLink.Field) then + begin + Text := FDataLink.Field.DisplayText; + WriteLn(' new text: "', Text, '"'); + end else + begin + Text := ''; + WriteLn('DataLink has no data'); + end; +end; + + +end. + + +{ + $Log: fpgui_db.pp,v $ + Revision 1.2 2001/01/17 21:36:26 sg + * Updating fixes + + Revision 1.1 2000/12/23 23:20:16 sg + * First public CVS version... + +} diff --git a/gui/defimpl/defstyle.inc b/gui/defimpl/defstyle.inc new file mode 100644 index 00000000..a0c5f5d5 --- /dev/null +++ b/gui/defimpl/defstyle.inc @@ -0,0 +1,68 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Default Style class implementation + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{$IFNDEF Has_DefaultStyle_GetGUIColor} + +function TDefaultStyle.GetGUIColor(Color: TColor): TGfxColor; +begin + case Color of + // UI element colors + clScrollBar: Result := GetUIColor(clSilver); + clMenu: Result := GetUIColor(clSilver); + clWindow: Result := GetUIColor(clWhite); + clMenuText: Result := GetUIColor(clBlack); + clWindowText: Result := GetUIColor(clBlack); + clAppWorkSpace: Result := GetUIColor(clGray); + clHighlight: Result := GetUIColor(clNavy); + clHighlightText: Result := GetUIColor(clWhite); + cl3DFace: Result := GetUIColor(clSilver); + cl3DShadow: Result := GetUIColor(clGray); + clGrayText: Result := GetUIColor(clGray); + clBtnText: Result := GetUIColor(clBlack); + cl3DHighlight: Result := GetUIColor(clWhite); + cl3DDkShadow: Result := GetUIColor(clBlack); + cl3DLight: Result := rgbaDkWhite; + clInfoText: Result := GetUIColor(clBlack); + clInfoBk: Result := GetUIColor(clLightYellow); + + else Result := GetUIColor(clWhite); + end; +end; + +{$ENDIF} + + +{$IFNDEF Has_DefaultStyle_DrawFocusRect} + +procedure TDefaultStyle.DrawFocusRect(Canvas: TFCanvas; const ARect: TRect); +begin + // !!!: Disabled for Linux as long a a certain nVidia X-Server has bugs with this... + + Canvas.SetColor(GetUIColor(cl3DDkShadow)); + Canvas.SetLineStyle(lsDot); + Canvas.DrawRect(ARect); + Canvas.SetLineStyle(lsSolid); + +// Canvas.SetColor(rgbaGray); +// Canvas.DrawRect(ARect); +end; + +{$ENDIF} + + diff --git a/gui/dialogs.inc b/gui/dialogs.inc new file mode 100644 index 00000000..c56bd8bd --- /dev/null +++ b/gui/dialogs.inc @@ -0,0 +1,162 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Dialogs declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + +{%mainunit fpgui.pp} + + +{$IFDEF read_interface} + + TCustomStandardDialog = class(TCustomForm) + private + procedure StdBtnClicked(Sender: TObject); + protected + FButtons: TMsgDlgButtons; + MainLayout, BtnLayout: TBoxLayout; + Separator: TSeparator; + function ProcessEvent(Event: TEventObj): Boolean; override; + function DistributeEvent(Event: TEventObj): Boolean; override; + procedure CalcSizes; override; + procedure Resized; override; + procedure SetButtons(AButtons: TMsgDlgButtons); + property Buttons: TMsgDlgButtons read FButtons write SetButtons default [mbOk, mbCancel]; + public + constructor Create(AOwner: TComponent); override; + end; + + + TStandardDialog = class(TCustomStandardDialog) + published + property Text; + property OnCreate; + property Buttons; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + + +// =================================================================== +// TCustomStandardDialog +// =================================================================== + +// public methods + +constructor TCustomStandardDialog.Create(AOwner: TComponent); + + function AddBtn(const AText: String; ADefault: Boolean): TButton; + begin + Result := TButton.Create(Self); + Result.Text := AText; + // Result.Default := ADefault; + Result.OnClick := @StdBtnClicked; + Result.Parent := BtnLayout; + end; + +begin + inherited Create(AOwner); + FButtons := [mbOk, mbCancel]; + FBorderWidth := 4; + + MainLayout := TBoxLayout.Create(Self); + MainLayout.Orientation := Vertical; + MainLayout.SetEmbeddedParent(Self); + + Separator := TSeparator.Create(Self); + Separator.Parent := MainLayout; + + BtnLayout := TBoxLayout.Create(Self); + BtnLayout.Orientation := Horizontal; + BtnLayout.HorzAlign := horzRight; + BtnLayout.VertAlign := vertCenter; + BtnLayout.CanExpandHeight := False; + BtnLayout.Parent := MainLayout; + + if mbYes in FButtons then AddBtn(mbText_Yes, False); + if mbNo in FButtons then AddBtn(mbText_No, False); + if mbOk in FButtons then AddBtn(mbText_OK, True); + if mbCancel in FButtons then AddBtn(mbText_Cancel, False); + if mbApply in FButtons then AddBtn(mbText_Apply, False); + if mbAbort in FButtons then AddBtn(mbText_Abort, False); + if mbRetry in FButtons then AddBtn(mbText_Retry, False); + if mbIgnore in FButtons then AddBtn(mbText_Ignore, False); + if mbAll in FButtons then AddBtn(mbText_All, False); + if mbNoToAll in FButtons then AddBtn(mbText_NoToAll, False); + if mbYesToAll in FButtons then AddBtn(mbText_YesToAll, False); + if mbHelp in FButtons then AddBtn(mbText_Help, False); + +end; + + +// protected methods + +function TCustomStandardDialog.ProcessEvent(Event: TEventObj): Boolean; +begin + Result := MainLayout.ProcessEvent(Event) or inherited ProcessEvent(Event); +end; + +function TCustomStandardDialog.DistributeEvent(Event: TEventObj): Boolean; +begin + Result := Event.SendToChild(MainLayout) or inherited DistributeEvent(Event); +end; + +procedure TCustomStandardDialog.CalcSizes; +begin + if Assigned(Child) then + begin + FMinSize := Child.MinSize + 2 * BorderWidth; + FDefSize := Child.DefSize + 2 * BorderWidth; + FMaxSize.cx := Min(InfiniteSize, Child.MaxSize.cx + 2 * BorderWidth); + FMaxSize.cy := Min(InfiniteSize, Child.MaxSize.cy + 2 * BorderWidth); + end; + + FMinSize.cx := Max(MinSize.cx, MainLayout.MinSize.cx + 2 * BorderWidth); + Inc(FMinSize.cy, MainLayout.DefSize.cy + BorderWidth); + FDefSize.cx := Max(DefSize.cx, MainLayout.DefSize.cx + 2 * BorderWidth); + FDefSize.cy := Min(InfiniteSize, DefSize.cy); + FMaxSize.cx := Min(MaxSize.cx, MainLayout.MaxSize.cx + 2 * BorderWidth); + FMaxSize.cy := Min(InfiniteSize, MaxSize.cy + MainLayout.DefSize.cy); +end; + +procedure TCustomStandardDialog.Resized; +begin + if Assigned(Child) then + Child.SetBounds(Point(BorderWidth, BorderWidth), + gfxBase.Size(Width - 2 * BorderWidth, + Height - MainLayout.DefSize.cy - 2 * BorderWidth)); + MainLayout.SetBounds( + Point(BorderWidth, Height - MainLayout.DefSize.cy - BorderWidth), + gfxBase.Size(Width - 2 * BorderWidth, MainLayout.DefSize.cy - BorderWidth)); +end; + +procedure TCustomStandardDialog.SetButtons(AButtons: TMsgDlgButtons); +begin + FButtons := AButtons; +end; + +procedure TCustomStandardDialog.StdBtnClicked(Sender: TObject); +begin + Close; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/edit.inc b/gui/edit.inc new file mode 100644 index 00000000..3542de5f --- /dev/null +++ b/gui/edit.inc @@ -0,0 +1,375 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Edit class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + { TCustomEdit } + + TCustomEdit = class(TWidget) + private + FFontColor: TColor; + FSelStart: integer; + FSelOffset: integer; + FCursorPos: Integer; + FPasswordChar: Char; + FOnChange: TNotifyEvent; + procedure SetFontColor(const AValue: TColor); + procedure SetPasswordChar(APasswordChar: Char); + procedure SetCursorPos(ACursorPos: Integer); + procedure DoMousePressed(pEvent: TMousePressedEventObj); + protected + procedure Paint(Canvas: TFCanvas); override; + function ProcessEvent(Event: TEventObj): Boolean; override; + procedure CalcSizes; override; + procedure EvKeyPressed(Key: Word; Shift: TShiftState); override; + procedure EvKeyChar(KeyChar: Char); override; + procedure EvTextChanged; override; + property CanExpandWidth default True; + property Cursor default crIBeam; + property PasswordChar: Char read FPasswordChar write SetPasswordChar default #0; + property CursorPos: Integer read FCursorPos write SetCursorPos; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + property FontColor: TColor read FFontColor write SetFontColor; + procedure SetText(const AText: String); override; + public + constructor Create(AOwner: TComponent); override; + constructor Create(const pText: string; pOwner: TComponent); overload; + end; + + + TEdit = class(TCustomEdit) + published + property CanExpandWidth; + property Enabled; + property PasswordChar; + property Text; + property OnChange; + property FontColor; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +// =================================================================== +// TCustomEdit +// =================================================================== + +constructor TCustomEdit.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WidgetStyle := WidgetStyle + [wsCaptureMouse, wsClickable, wsOpaque]; + FCanExpandWidth := True; + FCursor := crIBeam; + FFontColor := clWindowText; + FCursorPos := 0; +end; + + +constructor TCustomEdit.Create(const pText: string; pOwner: TComponent); +begin + Create(pOwner); + Text := pText; +end; + + +procedure TCustomEdit.Paint(Canvas: TFCanvas); +var + Borders: TRect; + s: String; + x: Integer; + ItemRect: TRect; + ItemFlags: TItemFlags; +begin + ItemFlags := []; + Borders := Style.GetEditBoxBorders; + + Style.DrawEditBox(Canvas, Rect(0, 0, BoundsSize.cx, BoundsSize.cy)); + + if not Canvas.IntersectClipRect(Rect(Borders.Left + 1, Borders.Top + 1, + BoundsSize.cx - Borders.Right - 1, BoundsSize.cy - Borders.Bottom - 1)) then + exit; + + if wsEnabled in WidgetState then + Canvas.SetColor(Style.GetUIColor(FFontColor)) + else + Canvas.SetColor(Style.GetUIColor(clGrayText)); + + if PasswordChar = #0 then + s := PChar(Text) + else + begin + SetLength(s, Length(Text)); + if Length(Text) > 0 then + FillChar(s[1], Length(Text), PasswordChar); + end; + + + // drawing selection + if (FSelOffset <> 0) then + begin + if (wsHasFocus in WidgetState) and FindForm.IsActive then + begin + Include(ItemFlags, ifFocused); + Include(ItemFlags, ifSelected); + end; + + ItemRect.Left := Canvas.TextWidth(Copy(s, 1, CursorPos - FSelOffset)); + ItemRect.Top := 0; + ItemRect.Right := Canvas.TextWidth(Copy(s, 1, CursorPos)); + ItemRect.Bottom := Height; +{ + ItemRect := Rect(0, 0, Width, Height); + ItemRect.TopLeft := ItemRect.TopLeft + 1; + ItemRect.BottomRight := ItemRect.BottomRight - 2; +} +// InflateRect(ItemRect, -1, -1); + +// Style.SetUIColor(Canvas, clWindowText); + + {$Note Start here: Refine the selection rect} + Style.DrawItemBefore(Canvas, ItemRect, ItemFlags); + Style.DrawText(Canvas, (Borders.TopLeft + Point(1, 1)), s, WidgetState); + Style.DrawItemAfter(Canvas, ItemRect, ItemFlags); + end + else + Canvas.TextOut(Borders.TopLeft + Point(1, 1), s); + + + if wsHasFocus in WidgetState then + begin + Canvas.SetColor(Style.GetUIColor(clWindowText)); + x := Borders.Left + 1 + Canvas.TextWidth(Copy(s, 1, CursorPos)); + Canvas.DrawLine(Point(x, Borders.Top), Point(x, BoundsSize.cy - Borders.Bottom)); + end; +end; + + +function TCustomEdit.ProcessEvent(Event: TEventObj): Boolean; +begin + if Event.InheritsFrom(TMousePressedEventObj) then + begin +// Result := True; + DoMousePressed(TMousePressedEventObj(Event)); +// Writeln('>>> TMousePressedEventObj in ' + Classname); + end; + Result := inherited ProcessEvent(Event); +end; + + +procedure TCustomEdit.EvKeyPressed(Key: Word; Shift: TShiftState); +begin + if Shift * [ssShift, ssAlt, ssCtrl, ssMeta, ssSuper, ssHyper, ssAltGr] = [] then + begin +// Writeln('1'); + case Key of + keyLeft, keyUp: + if CursorPos > 0 then + CursorPos := CursorPos - 1; + keyRight, keyDown: + if CursorPos < Length(Text) then + CursorPos := CursorPos + 1; + keyHome: + CursorPos := 0; + keyEnd: + CursorPos := Length(Text); + else + inherited EvKeyPressed(Key, Shift); + end; + end +{ else if Shift * [ssShift, ssAlt, ssCtrl, ssMeta, ssSuper, ssHyper, ssAltGr] = [ssShift] then + begin + Writeln('2'); + case Key of + keyHome: + begin + FSelOffset := CursorPos; + CursorPos := 0; + end; + keyEnd: + begin + FSelOffset := CursorPos; + CursorPos := Length(Text); + end; + else + EvKeyPressed(Key, Shift); + end; + end +} + else + inherited EvKeyPressed(Key, Shift); +end; + + +procedure TCustomEdit.EvKeyChar(KeyChar: Char); +begin + case KeyChar of + #8: { Backspace } + if CursorPos > 0 then + begin + Text := Copy(Text, 1, CursorPos - 1) + Copy(Text, CursorPos + 1, Length(Text)); + CursorPos := CursorPos - 1; + end; + #127: { Del } + if CursorPos < Length(Text) then + begin + Text := Copy(Text, 1, CursorPos) + Copy(Text, CursorPos + 2, Length(Text)); + Redraw; + end; + #32..#126, #128..#255: + begin + Text := Copy(Text, 1, CursorPos) + KeyChar + Copy(Text, CursorPos + 1, Length(Text)); + CursorPos := CursorPos + 1; + end; + else + inherited EvKeyChar(KeyChar); + end; +end; + + +procedure TCustomEdit.CalcSizes; +var + Borders: TRect; +begin + Borders := Style.GetEditBoxBorders; + FMinSize := gfxbase.Size(50, Borders.Top + Borders.Bottom + + FindForm.Wnd.Canvas.FontCellHeight + 2); +end; + + +procedure TCustomEdit.EvTextChanged; +begin + Redraw; + if Assigned(OnChange) then + OnChange(Self); +end; + + +procedure TCustomEdit.SetText(const AText: String); +begin + FSelOffset := 0; + inherited SetText(AText); +end; + + +procedure TCustomEdit.SetPasswordChar(APasswordChar: Char); +begin + if APasswordChar <> PasswordChar then + begin + FPasswordChar := APasswordChar; + Redraw; + end; +end; + + +procedure TCustomEdit.SetFontColor(const AValue: TColor); +begin + if FFontColor = AValue then exit; + FFontColor := AValue; +end; + + +procedure TCustomEdit.SetCursorPos(ACursorPos: Integer); +begin + if ACursorPos <> CursorPos then + begin + FCursorPos := ACursorPos; + Redraw; + end; +end; + + +procedure TCustomEdit.DoMousePressed(pEvent: TMousePressedEventObj); +var + Borders: TRect; + cp: integer; + cpx: integer; + lSideMargin: integer; + n: integer; + cx: integer; + lText: string; + + // replicates pStrValue a set of pRepCount times. + function lReplicate(const pStrValue : string; pRepCount : Word) : string; + var + pResult, pValue: PChar; + lenValue: cardinal; + begin + if (pRepCount = 0) or (Pointer(pStrValue) = nil) then + exit; + + lenValue := Length(pStrValue); + SetLength(Result, lenValue * pRepCount); + pResult := Pointer(Result); + pValue := Pointer(pStrValue); + + while pRepCount <> 0 do + begin + Move(pValue^, pResult^, lenValue); + Inc(pResult, lenValue); + Dec(pRepCount); + end; + end; + +begin + if (pEvent.Button = mbLeft) then + begin + // searching for the appropriate character position + Borders := Style.GetEditBoxBorders; + lSideMargin := Borders.Left + 1; + cp := CursorPos; + + // Make sure we work with the correct displayed text + if FPasswordChar = #0 then + lText := Text + else + lText := lReplicate(FPasswordChar, Length(Text)); + + cpx := FindForm.Wnd.Canvas.TextWidth(Copy(lText, 1, CursorPos)) + lSideMargin; + + for n := 0 to Length(Text) do + begin + cx := FindForm.Wnd.Canvas.TextWidth(Copy(lText, 1, n)) + lSideMargin; + if abs(cx - pEvent.Position.x) < abs(cpx - pEvent.Position.x) then + begin + cpx := cx; + cp := n; + end; + end; + + FCursorPos := cp; + + if (ssShift in pEvent.Shift) then + begin + FSelOffset := FCursorPos - FSelStart; + end + else + begin + FSelStart := cp; + FSelOffset := 0; + end; + end; +end; + +{$ENDIF read_implementation} + diff --git a/gui/form.inc b/gui/form.inc new file mode 100644 index 00000000..10d18450 --- /dev/null +++ b/gui/form.inc @@ -0,0 +1,576 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Form class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + { TCustomForm } + + TCustomForm = class(TBinWidget) + private + FFocusedWidget: TWidget; + FMouseCaptureWidget: TWidget; + FLastSetCursor: TGfxCursor; + FWindowOptions: TGfxWindowOptions; + FWnd: TFCustomWindow; + FOnCreate: TNotifyEvent; + FOnDestroy: TNotifyEvent; + FOnActivate: TNotifyEvent; + FOnDeactivate: TNotifyEvent; + // Property access + function GetWnd: TFCustomWindow; + procedure SetFocusedWidget(AWidget: TWidget); + procedure SetMouseCaptureWidget(AWidget: TWidget); + procedure SetWindowOptions(const AValue: TGfxWindowOptions); + // fpGFX event handling + procedure WndClose(Sender: TObject); + procedure WndFocusIn(Sender: TObject); + procedure WndFocusOut(Sender: TObject); + procedure WndHide(Sender: TObject); + procedure WndKeyPressed(Sender: TObject; AKey: Word; AShift: TShiftState); + procedure WndKeyReleased(Sender: TObject; AKey: Word; AShift: TShiftState); + procedure WndKeyChar(Sender: TObject; AKeyChar: Char); + procedure WndMouseEnter(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint); + procedure WndMouseLeave(Sender: TObject); + procedure WndMouseMoved(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint); + procedure WndMousePressed(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure WndMouseReleased(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint); + procedure WndMouseWheel(Sender: TObject; AShift: TShiftState; AWheelDelta: Single; const AMousePos: TPoint); + procedure WndPaint(Sender: TObject; const ARect: TRect); + procedure WndMove(Sender: TObject); + procedure WndResize(Sender: TObject); + procedure WndShow(Sender: TObject); + protected + FBorderWidth: Integer; + FIsActive, FResizedByUser, FPositionSpecified: Boolean; + procedure Loaded; override; + procedure Paint(Canvas: TFCanvas); override; + procedure Resized; override; + function WidgetCoords(AWidget: TWidget): TPoint; + function ProcessEvent(Event: TEventObj): Boolean; override; + procedure CalcSizes; override; + procedure EvTextChanged; override; + procedure CreateWnd; + property CanExpandWidth default True; + property CanExpandHeight default True; + property Cursor default crArrow; + property BorderWidth: Integer read FBorderWidth write FBorderWidth; + property OnCreate: TNotifyEvent read FOnCreate write FOnCreate; + property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy; + property OnActivate: TNotifyEvent read FOnActivate write FOnActivate; + property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Show; override; + procedure Close; virtual; + procedure SetPosition(APosition: TPoint); + property FocusedWidget: TWidget read FFocusedWidget write SetFocusedWidget; + property IsActive: Boolean read FIsActive; + property MouseCaptureWidget: TWidget read FMouseCaptureWidget write SetMouseCaptureWidget; + property WindowOptions: TGfxWindowOptions read FWindowOptions write SetWindowOptions; + property Wnd: TFCustomWindow read GetWnd; + end; + + + TForm = class(TCustomForm) + published + property Enabled; + property BorderWidth; + property WindowOptions; + property Text; + property OnCreate; + property OnDestroy; + property OnActivate; + property OnDeactivate; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +// =================================================================== +// TCustomForm +// =================================================================== + +constructor TCustomForm.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCanExpandWidth := True; + FCanExpandHeight := True; + FCursor := crArrow; + FWindowOptions := [woWindow]; + + if not Assigned(FStyle) then + FStyle := gStyleManager.DefaultStyle; +end; + + +destructor TCustomForm.Destroy; +begin + if Assigned(OnDestroy) then + OnDestroy(Self); + if Assigned(FWnd) then + FWnd.Free; + gApplication.Forms.Remove(Self); + inherited Destroy; +end; + + +procedure TCustomForm.Show; +begin + LAYOUTTRACE('TCustomForm.Show for %s:%s', [Name, ClassName]); + + if Assigned(Wnd) then ; // this makes sure that wnd is created + + FVisible := True; + FWnd.Show; +end; + + +procedure TCustomForm.Close; +begin + FVisible := False; + FWnd.Free; + FWnd := nil; +end; + + +procedure TCustomForm.SetPosition(APosition: TPoint); +begin + if Assigned(FWnd) then + Wnd.SetPosition(APosition) + else + begin + FOrigin := APosition; + FPositionSpecified := True; + end; +end; + + +function TCustomForm.WidgetCoords(AWidget: TWidget): TPoint; +begin + Result := Point(0, 0); + while AWidget <> Self do + begin + Result := Result + AWidget.Parent.ClientToWidget(AWidget.Origin); + AWidget := AWidget.Parent; + end; +end; + + +procedure TCustomForm.Loaded; +begin + inherited Loaded; + if Assigned(OnCreate) then + OnCreate(Self); +end; + + +procedure TCustomForm.Paint(Canvas: TFCanvas); +begin + Style.DrawWindowBackground(Canvas, Rect(0, 0, Width, Height)); +end; + + +procedure TCustomForm.CalcSizes; +begin + if Assigned(Child) then + begin + FMinSize := Child.MinSize + 2 * BorderWidth; + FDefSize := Child.DefSize + 2 * BorderWidth; + FMaxSize.cx := Min(InfiniteSize, Child.MaxSize.cx + 2 * BorderWidth); + FMaxSize.cy := Min(InfiniteSize, Child.MaxSize.cy + 2 * BorderWidth); + end; +end; + + +function TCustomForm.ProcessEvent(Event: TEventObj): Boolean; +begin + if Event is TDestroyEventObj then + FWnd := nil; + + Result := inherited ProcessEvent(Event); +end; + + +procedure TCustomForm.EvTextChanged; +begin + if Assigned(FWnd) then + Wnd.Title := Text; +end; + + +procedure TCustomForm.CreateWnd; +var + ParentWnd: TFCustomWindow; +begin + if Parent is TCustomForm then + ParentWnd := TCustomForm(Parent).Wnd + else + ParentWnd := nil; + + FWnd := TFWindow.Create(ParentWnd, [woWindow]); +// FWnd := Application.DefaultScreen.CreateWindow(ParentWnd, [woWindow]); + if FPositionSpecified then + Wnd.SetPosition(Origin); + + Wnd.OnClose := @WndClose; + Wnd.OnFocusIn := @WndFocusIn; + Wnd.OnFocusOut := @WndFocusOut; + Wnd.OnHide := @WndHide; + Wnd.OnKeyPressed := @WndKeyPressed; + Wnd.OnKeyReleased := @WndKeyReleased; + Wnd.OnKeyChar := @WndKeyChar; + Wnd.OnMouseEnter := @WndMouseEnter; + Wnd.OnMouseLeave := @WndMouseLeave; + Wnd.OnMouseMove := @WndMouseMoved; + Wnd.OnMousePressed := @WndMousePressed; + Wnd.OnMouseReleased := @WndMouseReleased; + Wnd.OnMouseWheel := @WndMouseWheel; + Wnd.OnPaint := @WndPaint; + Wnd.OnMove := @WndMove; + Wnd.OnResize := @WndResize; + Wnd.OnShow := @WndShow; + + if Length(Text) = 0 then + Wnd.Title := gApplication.Title + else + Wnd.Title := Text; +end; + + +{ +procedure TCustomForm.ApplyNewLayout; +var + OrigW, OrigH: Integer; +begin + Wnd.SetMinMaxClientSize(MinW, MinH, MaxW, MaxH); + + OrigW := ClientRect.Right; + OrigH := ClientRect.Bottom; + + if (ClientRect.Right < MinW) or (ClientRect.Bottom < MinW) or + (ClientRect.Right > MaxW) or (ClientRect.Bottom > MaxH) then + begin + if ClientRect.Right < MinW then + FClientRect.Right := MinW; + if ClientRect.Bottom < MinH then + FClientRect.Bottom := MinH; + if ClientRect.Right > MaxW then + FClientRect.Right := MaxW; + if ClientRect.Bottom > MaxH then + FClientRect.Bottom := MaxH; +// Wnd.SetClientSize(ClientRect.Right, ClientRect.Bottom); + end; + + if not FResizedByUser then + begin + FClientRect.Right := DefW; + FClientRect.Bottom := DefH; + end; + + if (ClientRect.Right <> OrigW) or (ClientRect.Bottom <> OrigH) then + begin + LAYOUTTRACE('TCustomForm.EvRecalcLayout for %s:%s: Setting size to %dx%d', + [Name, ClassName, ClientRect.Right, ClientRect.Bottom]); + Wnd.SetClientSize(ClientRect.Right, ClientRect.Bottom); + end; +end;} + + +procedure TCustomForm.Resized; +begin + ClientRect.Right := Wnd.ClientWidth; + ClientRect.Bottom := Wnd.ClientHeight; + if Assigned(Child) then + Child.SetBounds(Point(BorderWidth, BorderWidth), + TSize(ClientRect.BottomRight) - 2 * BorderWidth); +end; + + +procedure TCustomForm.SetFocusedWidget(AWidget: TWidget); +begin + if AWidget <> FocusedWidget then + begin + if Assigned(FocusedWidget) then + begin + Exclude(FFocusedWidget.WidgetState, wsHasFocus); + FocusedWidget.EvFocusChanged; + end; + FFocusedWidget := AWidget; + if Assigned(FocusedWidget) then + begin + Include(FFocusedWidget.WidgetState, wsHasFocus); + FocusedWidget.EvFocusChanged; + end; + end; +end; + +function TCustomForm.GetWnd: TFCustomWindow; +begin + if not Assigned(FWnd) then + begin + CreateWnd; + // !!!: Doesn't handle a set initial size yet + SendEvent(TCalcSizesEventObj.Create(Self)); + Wnd.SetMinMaxClientSize(MinSize, MaxSize); + Wnd.SetClientSize(DefSize); + end; + Result := FWnd; +end; + + +procedure TCustomForm.SetMouseCaptureWidget(AWidget: TWidget); +begin + if AWidget <> FMouseCaptureWidget then + begin + FMouseCaptureWidget := AWidget; + if Assigned(AWidget) then + Wnd.CaptureMouse + else + Wnd.ReleaseMouse; + end; +end; + +procedure TCustomForm.SetWindowOptions(const AValue: TGfxWindowOptions); +begin + if FWindowOptions=AValue then exit; + FWindowOptions:=AValue; + if Assigned(FWnd) then Wnd.WindowOptions := AValue; +end; + + +// GfxWindow message handlers + +procedure TCustomForm.WndClose(Sender: TObject); +begin + SendEvent(TDestroyEventObj.Create(Self)); + FMouseCaptureWidget := nil; +end; + +procedure TCustomForm.WndFocusIn(Sender: TObject); +begin + FIsActive := True; + if Assigned(FocusedWidget) then + FocusedWidget.EvFocusChanged; + if Assigned(OnActivate) then + OnActivate(Self); +end; + +procedure TCustomForm.WndFocusOut(Sender: TObject); +begin + FIsActive := False; + if Assigned(FocusedWidget) then + FocusedWidget.EvFocusChanged; + if Assigned(OnDeactivate) then + OnDeactivate(Self); +end; + +procedure TCustomForm.WndHide(Sender: TObject); +begin + LAYOUTTRACE('TCustomForm.WndHide for %s:%s', [Name, ClassName]); + if wsIsVisible in WidgetState then + begin + Exclude(WidgetState, wsIsVisible); + SendEvent(TVisibilityChangeEventObj.Create(Self)); + Update; + end; +end; + +procedure TCustomForm.WndKeyPressed(Sender: TObject; + AKey: Word; AShift: TShiftState); +begin + if Assigned(FocusedWidget) then + FocusedWidget.EvKeyPressed(AKey, AShift) + else + EvKeyPressed(AKey, AShift); +end; + +procedure TCustomForm.WndKeyReleased(Sender: TObject; + AKey: Word; AShift: TShiftState); +begin + if Assigned(FocusedWidget) then + FocusedWidget.EvKeyReleased(AKey, AShift) + else + EvKeyReleased(AKey, AShift); +end; + +procedure TCustomForm.WndKeyChar(Sender: TObject; AKeyChar: Char); +begin + if Assigned(FocusedWidget) then + FocusedWidget.EvKeyChar(AKeyChar) + else + EvKeyChar(AKeyChar); +end; + +procedure TCustomForm.WndMouseEnter(Sender: TObject; + AShift: TShiftState; const AMousePos: TPoint); +begin + if wsEnabled in WidgetState then + DoMouseEnter(AShift, AMousePos); +end; + + +procedure TCustomForm.WndMouseLeave(Sender: TObject); +begin + if wsEnabled in WidgetState then + SendEvent(TMouseLeaveEventObj.Create(Self)); +end; + + +procedure TCustomForm.WndMouseMoved(Sender: TObject; + AShift: TShiftState; const AMousePos: TPoint); +{var + dx, dy: Integer; + IsInside: Boolean; +begin + if Assigned(MouseCaptureWidget) then + begin + WidgetCoords(MouseCaptureWidget, dx, dy); + + // Emulate MouseEnter/MouseLeave events + IsInside := (x >= dx) and (y >= dy) and + (x < dx + MouseCaptureWidget.Width) and (y < dy + MouseCaptureWidget.Height); + if IsInside and not (wsMouseInside in MouseCaptureWidget.WidgetState) then + MouseCaptureWidget.EvMouseEnter(Shift, x - dy, y - dy) + else if (not IsInside) and (wsMouseInside in MouseCaptureWidget.WidgetState) then + MouseCaptureWidget.EvMouseLeave; + + MouseCaptureWidget.SendEvent( + TMouseMovedEventObj.Create(Self, Shift, x - dx, y - dy)); + end else} + + procedure SendMouseEvents(Widget: TWidget; APos: TPoint); + var + LeaveCheckEvent: TMouseLeaveCheckEventObj; + begin + LeaveCheckEvent := TMouseLeaveCheckEventObj.Create(Self, AShift, APos); + LeaveCheckEvent.AddRef; + Widget.SendEvent(LeaveCheckEvent); + Widget.SendEvent(TMouseMoveEventObj.Create(Self, AShift, APos)); + if (LeaveCheckEvent.NewCursor <> crDefault) and + (LeaveCheckEvent.NewCursor <> Wnd.Cursor) then + Wnd.Cursor := LeaveCheckEvent.NewCursor; + LeaveCheckEvent.Free; + end; + +begin + if wsEnabled in WidgetState then + begin + if Assigned(MouseCaptureWidget) then + begin + SendMouseEvents(MouseCaptureWidget, + AMousePos - WidgetCoords(MouseCaptureWidget)); + if not Assigned(MouseCaptureWidget) then + SendMouseEvents(Self, AMousePos); + end else + SendMouseEvents(Self, AMousePos); + end; { if } +end; + + +procedure TCustomForm.WndMousePressed(Sender: TObject; AButton: TMouseButton; + AShift: TShiftState; const AMousePos: TPoint); +begin + if wsEnabled in WidgetState then + begin + if Assigned(MouseCaptureWidget) then + begin + MouseCaptureWidget.SendEvent( + TMousePressedEventObj.Create(Self, AButton, AShift, + AMousePos - WidgetCoords(MouseCaptureWidget))); + if not Assigned(MouseCaptureWidget) then + SendEvent(TMouseMoveEventObj.Create(Self, AShift, AMousePos)); + end + else + SendEvent(TMousePressedEventObj.Create(Self, AButton, AShift, AMousePos)); + end; { if } +end; + + +procedure TCustomForm.WndMouseReleased(Sender: TObject; AButton: TMouseButton; + AShift: TShiftState; const AMousePos: TPoint); +begin + if wsEnabled in WidgetState then + if Assigned(MouseCaptureWidget) then + begin + MouseCaptureWidget.SendEvent( + TMouseReleasedEventObj.Create(Self, AButton, AShift, + AMousePos - WidgetCoords(MouseCaptureWidget))); + if not Assigned(MouseCaptureWidget) then + SendEvent(TMouseMoveEventObj.Create(Self, AShift, AMousePos)); + end else + SendEvent(TMouseReleasedEventObj.Create(Self, + AButton, AShift, AMousePos)); +end; + + +procedure TCustomForm.WndMouseWheel(Sender: TObject; AShift: TShiftState; + AWheelDelta: Single; const AMousePos: TPoint); +begin + if wsEnabled in WidgetState then + SendEvent(TMouseWheelEventObj.Create(Self, AShift, AWheelDelta, AMousePos)); +end; + + +procedure TCustomForm.WndPaint(Sender: TObject; const ARect: TRect); +begin + LAYOUTTRACE('TCustomForm.WndPaint for %s:%s (%d/%d-%d/%d)', + [Name, ClassName, ARect.Left, ARect.Top, ARect.Right, ARect.Bottom]); + if wsIsVisible in WidgetState then + SendEvent(TPaintEventObj.Create(Self, TFCanvas(Wnd.Canvas))); +end; + + +procedure TCustomForm.WndMove(Sender: TObject); +begin + FOrigin := Point(Wnd.Left, Wnd.Top); +end; + + +procedure TCustomForm.WndResize(Sender: TObject); +begin + LAYOUTTRACE('TCustomForm.WndResize for %s:%s: New size is %dx%d. Visible? %d', + [Name, ClassName, Wnd.Width, Wnd.Height, Ord(wsIsVisible in WidgetState)]); + if Visible or (wsIsVisible in WidgetState) then + begin + FResizedByUser := (Wnd.Width <> DefSize.cx) or (Wnd.Height <> DefSize.cy); + SetBounds(Origin, gfxBase.Size(Wnd.Width, Wnd.Height)); + end; +end; + + +procedure TCustomForm.WndShow(Sender: TObject); +begin + LAYOUTTRACE('TCustomForm.WndShow for %s:%s', [Name, ClassName]); + if not (wsIsVisible in WidgetState) then + begin + Include(WidgetState, wsIsVisible); + SendEvent(TVisibilityChangeEventObj.Create(Self)); + end; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/fpgui.pas b/gui/fpgui.pas new file mode 100644 index 00000000..592397fa --- /dev/null +++ b/gui/fpgui.pas @@ -0,0 +1,294 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + fpGUI master file + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + +{ + Description: + It is fully object-oriented; its main goal is to provide its services + independent of any operating system or graphics environment. All painting + is done using fpGFX, while fpGUI provides a comfortable widget set and + other high-level classes. +} + + +unit fpGUI; + +{.$DEFINE LAYOUTTRACES} +{.$DEFINE TRACEEVENTS} + +{$IFDEF Debug} + {$ASSERTIONS On} +{$ENDIF} +{$mode objfpc}{$h+} + +interface + +uses +{$IFDEF mswindows} + Windows, GFX_GDI, // This must be removed!!! +{$ENDIF} + SysUtils + ,Classes +// ,DOM + ,GFXBase +// ,GFXInterface + ,fpgfx +// ,Types { used for OffsetRect() } +// ,Contnrs + ; + +type + TColor = type LongWord; + +const + + InfiniteSize = 16383; + +{$I colors.inc} + +resourcestring + mbText_Yes = 'Yes'; + mbText_No = 'No'; + mbText_Ok = 'Ok'; + mbText_Cancel = 'Cancel'; + mbText_Apply = 'Apply'; + mbText_Abort = 'Abort'; + mbText_Retry = 'Retry'; + mbText_Ignore = 'Ignore'; + mbText_All = 'All'; + mbText_NoToAll = 'No to all'; + mbText_YesToAll = 'Yes to all'; + mbText_Help = 'Help'; + + +type + TWidget = class; + TEventObj = class; + TCustomForm = class; + + + TWidgetState = set of ( + wsEnabled, + wsIsVisible, + wsSizeIsForced, + wsHasFocus, + wsMouseInside, + wsClicked + ); + + + TOrientation = (Horizontal, Vertical); + + + // The following flags are used for styles + + TButtonFlags = set of (btnIsEmbedded, btnIsDefault, btnIsPressed, + btnIsSelected, btnHasFocus); + + TCheckboxFlags = set of (cbIsPressed, cbHasFocus, cbIsEnabled, cbIsChecked); + + + // Other stuff + + TMsgDlgBtn = (mbYes, mbNo, mbOK, mbCancel, mbApply, mbAbort, mbRetry, + mbIgnore, mbAll, mbNoToAll, mbYesToAll, mbHelp); + TMsgDlgButtons = set of TMsgDlgBtn; + + + // Panel & Frame types + + TBevelStyle = (bsPlain, bsLowered, bsRaised); + + TBevelShape = (bsNoFrame, bsBox, bsFrame, bsBottomLine, bsLeftLine, + bsRightLine, bsTopLine); + + + +{ This lets us use a single include file for both the Interface and + Implementation sections. } +{$define read_interface} +{$undef read_implementation} + + +{$I style.inc} +{$I widget.inc} +{$I container.inc} +{$I bin.inc} +{$I layouts.inc} +{$I form.inc} +{$I popupwindow.inc} +{$I label.inc} +{$I edit.inc} +{$I buttons.inc} +{$I scrollbar.inc} +{$I scrollbox.inc} +{$I checkbox.inc} +{$I radiobutton.inc} +{$I separator.inc} +{$I groupbox.inc} +{$I listbox.inc} +{$I combobox.inc} +{$I grid.inc} +{$I dialogs.inc} +{.$I application.inc} +{$I panel.inc} +{$I menus.inc} +{$I progressbar.inc} + + +//var +// Application: TApplication; + + +function Min(a, b: Integer): Integer; inline; +function Max(a, b: Integer): Integer; inline; +function ClipMinMax(val, min, max: Integer): Integer; inline; + + +implementation +uses +// XMLRead {!!!:, XMLStreaming} + Math + ,StyleManager + ; + + +resourcestring + sListIndexError = 'List index exceeds bounds (%d)'; + + +{$IFDEF TraceEvents} +var + EventNestingLevel: Integer; +{$ENDIF} + + +function Min(a, b: Integer): Integer; +begin + if a < b then + Result := a + else + Result := b; +end; + + +function Max(a, b: Integer): Integer; +begin + if a > b then + Result := a + else + Result := b; +end; + + +function ClipMinMax(val, min, max: Integer): Integer; +begin + if val < min then + Result := min + else if val > max then + begin + Result := max; + if Result < min then + Result := min; + end else + Result := val; +end; + + +{$IFDEF LAYOUTTRACES} +procedure LAYOUTTRACE(const Position: String; const args: array of const); +{$IFDEF TraceEvents} +var + i: Integer; +{$ENDIF} +begin + {$IFDEF TraceEvents} + for i := 1 to EventNestingLevel do + Write(' '); + {$ENDIF} + WriteLn(Format(Position, args)); +end; +{$ELSE} +procedure LAYOUTTRACE(const Position: String; const args: array of const); +begin +end; +{$ENDIF} + + +{ This lets us use a single include file for both the Interface and + Implementation sections. } +{$undef read_interface} +{$define read_implementation} + + +{$I style.inc} +{$I widget.inc} +{$I container.inc} +{$I bin.inc} +{$I layouts.inc} +{$I form.inc} +{$I popupwindow.inc} +{$I label.inc} +{$I edit.inc} +{$I buttons.inc} +{$I scrollbar.inc} +{$I scrollbox.inc} +{$I checkbox.inc} +{$I radiobutton.inc} +{$I separator.inc} +{$I groupbox.inc} +{$I listbox.inc} +{$I combobox.inc} +{$I grid.inc} +{$I dialogs.inc} +{.$I application.inc} +{$I panel.inc} +{$I menus.inc} +{$I progressbar.inc} + + +const + Orientations: array[TOrientation] of TIdentMapEntry = ( + (Value: Ord(Horizontal); Name: 'Horizontal'), + (Value: Ord(Vertical); Name: 'Vertical') + ); + + +function IdentToOrientation(const Ident: String; var Orientation: LongInt): Boolean; +begin + Result := IdentToInt(Ident, Orientation, Orientations); +end; + + +function OrientationToIdent(Orientation: LongInt; var Ident: String): Boolean; +begin + Result := IntToIdent(Orientation, Ident, Orientations); +end; + + +initialization + RegisterIntegerConsts(TypeInfo(TOrientation), + @IdentToOrientation, @OrientationToIdent); + +// Application := TApplication.Create; + + +finalization +// Application.Free; + +end. + diff --git a/gui/fpgui.rst b/gui/fpgui.rst new file mode 100644 index 00000000..ad20464a --- /dev/null +++ b/gui/fpgui.rst @@ -0,0 +1,60 @@ + +# hash value = 24515 +fpgui.mbtext_yes='Yes' + + +# hash value = 1359 +fpgui.mbtext_no='No' + + +# hash value = 1371 +fpgui.mbtext_ok='Ok' + + +# hash value = 77089212 +fpgui.mbtext_cancel='Cancel' + + +# hash value = 4749113 +fpgui.mbtext_apply='Apply' + + +# hash value = 4691604 +fpgui.mbtext_abort='Abort' + + +# hash value = 5819289 +fpgui.mbtext_retry='Retry' + + +# hash value = 83777157 +fpgui.mbtext_ignore='Ignore' + + +# hash value = 18476 +fpgui.mbtext_all='All' + + +# hash value = 129053500 +fpgui.mbtext_notoall='No to all' + + +# hash value = 129277052 +fpgui.mbtext_yestoall='Yes to all' + + +# hash value = 322608 +fpgui.mbtext_help='Help' + + +# hash value = 162403993 +fpgui.slistindexerror='List index exceeds bounds (%d)' + + +# hash value = 100314660 +fpgui.slayoutwidgetnotfound='Layout child widget not found' + + +# hash value = 165560901 +fpgui.sgridindexoutofrange='Grid index out of range' + diff --git a/gui/fpguipackage.lpk b/gui/fpguipackage.lpk new file mode 100644 index 00000000..771a7bea --- /dev/null +++ b/gui/fpguipackage.lpk @@ -0,0 +1,57 @@ +<?xml version="1.0"?> +<CONFIG> + <Package Version="2"> + <Name Value="fpguipackage"/> + <Author Value="Graeme Geldenhuys"/> + <CompilerOptions> + <Version Value="5"/> + <SearchPaths> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <AllowLabel Value="False"/> + </SyntaxOptions> + </Parsing> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-dDEBUGx"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Description Value="Free Pascal Graphical User Interface +"/> + <License Value="Modified LGPL +"/> + <Version Minor="3"/> + <Files Count="2"> + <Item1> + <Filename Value="stylemanager.pas"/> + <UnitName Value="stylemanager"/> + </Item1> + <Item2> + <Filename Value="fpgui.pas"/> + <UnitName Value="fpGUI"/> + </Item2> + </Files> + <RequiredPkgs Count="2"> + <Item1> + <PackageName Value="fpgfxpackage"/> + <MinVersion Minor="3" Valid="True"/> + </Item1> + <Item2> + <PackageName Value="FCL"/> + <MinVersion Major="1" Valid="True"/> + </Item2> + </RequiredPkgs> + <UsageOptions> + <UnitPath Value="$(PkgOutDir)/"/> + </UsageOptions> + <PublishOptions> + <Version Value="2"/> + <IgnoreBinaries Value="False"/> + </PublishOptions> + </Package> +</CONFIG> diff --git a/gui/fpguipackage.pas b/gui/fpguipackage.pas new file mode 100644 index 00000000..628f8804 --- /dev/null +++ b/gui/fpguipackage.pas @@ -0,0 +1,14 @@ +{ This file was automatically created by Lazarus. Do not edit! +This source is only used to compile and install the package. + } + +unit fpguipackage; + +interface + +uses + stylemanager, fpGUI; + +implementation + +end. diff --git a/gui/grid.inc b/gui/grid.inc new file mode 100644 index 00000000..7079c3f7 --- /dev/null +++ b/gui/grid.inc @@ -0,0 +1,658 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Grid class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + +// ------------------------------------------------------------------- +// TCustomGrid +// ------------------------------------------------------------------- + + EInvalidGridOperation = class(Exception); + + TGridDrawState = set of (gdSelected, gdFocused, gdFixed); + + + PIntegerArray = ^TIntegerArray; + TIntegerArray = array[0..(MAXINT div SizeOf(Integer))-1] of Integer; + + + TCustomGrid = class(TWidget) + private + FColCount: Integer; + FRowCount: Integer; + FFixedCols: Integer; + FFixedRows: Integer; + FDefaultColWidth: Integer; + FDefaultRowHeight: Integer; + FGridWidth: Integer; + FGridHeight: Integer; + FFixedWidth: Integer; + FFixedHeight: Integer; + FColWidths, FRowHeights: PIntegerArray; + procedure SetColCount(AColCount: Integer); + procedure SetRowCount(ARowCount: Integer); + procedure SetFixedCols(AFixedCols: Integer); + procedure SetFixedRows(AFixedRows: Integer); + procedure SetDefaultColWidth(AWidth: Integer); + procedure SetDefaultRowHeight(AHeight: Integer); + function GetColWidths(ACol: Integer): Integer; + procedure SetColWidths(ACol, AWidth: Integer); + function GetRowHeights(ARow: Integer): Integer; + procedure SetRowHeights(ARow, AHeight: Integer); + procedure HorzScrollBarScroll(Sender: TObject; var APosition: Integer); + procedure VertScrollBarScroll(Sender: TObject; var APosition: Integer); + protected + ScrollingSupport: TScrollingSupport; + procedure Paint(Canvas: TFCanvas); override; + function ProcessEvent(Event: TEventObj): Boolean; override; + function DistributeEvent(Event: TEventObj): Boolean; override; + procedure CalcSizes; override; + procedure Resized; override; + procedure ColWidthsChanged; dynamic; + procedure DrawCell(ACanvas: TFCanvas; ACol, ARow: Integer; ARect: TRect; AState: TGridDrawState); virtual; abstract; + procedure RowHeightsChanged; dynamic; + procedure SizeChanged(OldColCount, OldRowCount: Integer); dynamic; + property CanExpandWidth default True; + property CanExpandHeight default True; + property ColCount: Integer read FColCount write SetColCount default 5; + property RowCount: Integer read FRowCount write SetRowCount default 5; + property FixedCols: Integer read FFixedCols write SetFixedCols default 1; + property FixedRows: Integer read FFixedRows write SetFixedRows default 1; + property GridWidth: Integer read FGridWidth; + property GridHeight: Integer read FGridHeight; + property FixedWidth: Integer read FFixedWidth; + property FixedHeight: Integer read FFixedHeight; + property DefaultColWidth: Integer read FDefaultColWidth write SetDefaultColWidth default 64; + property DefaultRowHeight: Integer read FDefaultRowHeight write SetDefaultRowHeight default 24; + property ColWidths[ACol: Integer]: Integer read GetColWidths write SetColWidths; + property RowHeights[ARow: Integer]: Integer read GetRowHeights write SetRowHeights; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + end; + + +// ------------------------------------------------------------------- +// TDrawGrid +// ------------------------------------------------------------------- + + TDrawCellEvent = procedure(Sender: TObject; ACanvas: TFCanvas; + ACol, ARow: Integer; Rect: TRect; State: TGridDrawState) of object; + + + TDrawGrid = class(TCustomGrid) + private + FOnDrawCell: TDrawCellEvent; + protected + procedure DrawCell(ACanvas: TFCanvas; ACol, ARow: Integer; ARect: TRect; AState: TGridDrawState); override; + public + function CellRect(ACol, ARow: Integer): TRect; + property ColWidths; + property RowHeights; + published + property CanExpandWidth; + property CanExpandHeight; + property ColCount; + property RowCount; + property FixedCols; + property FixedRows; + property DefaultColWidth; + property DefaultRowHeight; + property OnDrawCell: TDrawCellEvent read FOnDrawCell write FOnDrawCell; + end; + + +// ------------------------------------------------------------------- +// TStringGrid +// ------------------------------------------------------------------- + + PCells = ^TCells; + TCells = array[0..(1 shl 30) div SizeOf(AnsiString)] of AnsiString; + + + TStringGrid = class(TDrawGrid) + private + CellStrings: PCells; + function GetCells(ACol, ARow: Integer): String; + procedure SetCells(ACol, ARow: Integer; const AValue: String); + protected + //function GetEditText(ACol, ARow: Integer): String; override; + //procedure SetEditText(ACol, ARow: Integer; const AValue: String); override; + procedure SizeChanged(OldColCount, OldRowCount: Integer); override; + //procedure ColumnMoved(AFrom, ATo: Integer); override; + //procedure RowMoved(AFrom, ATo: Integer); override; + procedure DrawCell(ACanvas: TFCanvas; ACol, ARow: Integer; ARect: TRect; AState: TGridDrawState); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property Cells[ACol, ARow: Integer]: String read GetCells write SetCells; + property Cols[Index: Integer]: TStrings; + property Objects[ACol, ARow: Integer]: TObject; + property Rows[Index: Integer]: TStrings; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + +resourcestring + + SGridIndexOutOfRange = 'Grid index out of range'; + +// =================================================================== +// TCustomGrid +// =================================================================== + +// public methods + +constructor TCustomGrid.Create(AOwner: TComponent); +var + i: Integer; +begin + inherited Create(AOwner); + WidgetStyle := WidgetStyle + [wsOpaque]; + FCanExpandWidth := True; + FCanExpandHeight := True; + ScrollingSupport := TScrollingSupport.Create(Self); + ScrollingSupport.HorzScrollBar.OnScroll := @HorzScrollBarScroll; + ScrollingSupport.VertScrollBar.OnScroll := @VertScrollBarScroll; + + FDefaultColWidth := 64; + FDefaultRowHeight := 24; + FColCount := 5; + FRowCount := 5; + FFixedCols := 1; + FFixedRows := 1; + GetMem(FColWidths, FColCount * SizeOf(Integer)); + GetMem(FRowHeights, FRowCount * SizeOf(Integer)); + + for i := 0 to 4 do + begin + FColWidths^[i] := FDefaultColWidth; + FRowHeights^[i] := FDefaultRowHeight; + end; + ColWidthsChanged; + RowHeightsChanged; +end; + +destructor TCustomGrid.Destroy; +begin + FreeMem(FRowHeights); + FreeMem(FColWidths); + ScrollingSupport.Free; + inherited Destroy; +end; + + +// protected methods + +procedure TCustomGrid.Paint(Canvas: TFCanvas); +var + x1, y1, x2, y2, x, y, Sum: Integer; + CellRect: TRect; + GridDrawState: TGridDrawState; +begin + if not Canvas.IntersectClipRect(ScrollingSupport.ClientRect) then + exit; + + with Canvas.GetClipRect do + begin + x1 := Left; + y1 := Top; + x2 := Right; + y2 := Bottom; + end; + + { Initialize these for the case that the cell drawing loop won't get + executed at all: } + CellRect.Left := 0; + CellRect.Right := 0; + + // Draw the cells + + CellRect.Top := ScrollingSupport.ClientRect.Top; + y := 0; + while y < RowCount do + begin + CellRect.Bottom := CellRect.Top + RowHeights[y]; + if CellRect.Bottom > y1 then + begin + CellRect.Left := ScrollingSupport.ClientRect.Left; + x := 0; + while x < ColCount do + begin + CellRect.Right := CellRect.Left + ColWidths[x]; + if CellRect.Right > x1 then + begin + GridDrawState := []; + if (x < FixedCols) or (y < FixedRows) then + Include(GridDrawState, gdFixed); + + Canvas.SaveState; + if gdFixed in GridDrawState then + begin + with CellRect do + Style.DrawButtonFace(Canvas, + Rect(Left, Top, Right + 1, Bottom + 1), []); + Style.SetUIColor(Canvas, clBtnText); + end else + begin + Style.SetUIColor(Canvas, clWindow); + Canvas.FillRect(CellRect); + Style.SetUIColor(Canvas, clWindowText); + end; + DrawCell(Canvas, x, y, CellRect, GridDrawState); + Canvas.RestoreState; + end; + + CellRect.Left := CellRect.Right + 1; + if CellRect.Left >= x2 then + break; + + Inc(x); + if x = FixedRows then + Inc(x, ScrollingSupport.HorzScrollBar.Position); + end; + end; + + CellRect.Top := CellRect.Bottom + 1; + if CellRect.Top >= y2 then + break; + + Inc(y); + if y = FixedRows then + Inc(y, ScrollingSupport.VertScrollBar.Position); + end; + + + // Draw the grid lines + + Style.SetUIColor(Canvas, cl3DFace); + + y := 0; + Sum := ScrollingSupport.ClientRect.Top; + while y < RowCount do + begin + Inc(Sum, RowHeights[y]); + if (y >= FixedRows) and (Sum >= y1) then + Canvas.DrawLine(Point(ScrollingSupport.ClientRect.Left + FixedWidth, Sum), + Point(CellRect.Right + 1, Sum)); + Inc(Sum); + if Sum >= y2 then + break; + + Inc(y); + if y = FixedRows then + Inc(y, ScrollingSupport.VertScrollBar.Position); + end; + + x := 0; + Sum := ScrollingSupport.ClientRect.Left; + while x < ColCount do + begin + Inc(Sum, ColWidths[x]); + if (x >= FixedCols) and (Sum >= x1) then + Canvas.DrawLine(Point(Sum, ScrollingSupport.ClientRect.Top + FixedHeight), + Point(Sum, CellRect.Bottom)); + Inc(Sum); + if Sum >= x2 then + break; + + Inc(x); + if x = FixedCols then + Inc(x, ScrollingSupport.HorzScrollBar.Position); + end; + + + // Clear the empty space right and below the grid itself + + Style.SetUIColor(Canvas, clWindow); + if CellRect.Right + 1 < x2 then + Canvas.FillRect(Rect(CellRect.Right + 1, y1, x2, y2)); + if CellRect.Bottom + 1 < y2 then + Canvas.FillRect(Rect(x1, CellRect.Top, CellRect.Right + 1, y2)); +end; + +function TCustomGrid.ProcessEvent(Event: TEventObj): Boolean; +begin + Result := ScrollingSupport.ProcessEvent(Event) or + inherited ProcessEvent(Event); +end; + +function TCustomGrid.DistributeEvent(Event: TEventObj): Boolean; +begin + Result := ScrollingSupport.DistributeEvent(Event) or + inherited DistributeEvent(Event); +end; + +procedure TCustomGrid.CalcSizes; +begin + ScrollingSupport.CalcSizes; +end; + +procedure TCustomGrid.Resized; +begin + ScrollingSupport.Resized; +end; + +procedure TCustomGrid.ColWidthsChanged; +var + i: Integer; +begin + FGridWidth := 0; + for i := 0 to ColCount - 1 do + Inc(FGridWidth, ColWidths[i] + 1); + if FGridWidth > 0 then + Dec(FGridWidth); + + FFixedWidth := 0; + for i := 0 to FixedCols - 1 do + Inc(FFixedWidth, ColWidths[i] + 1); + if FFixedWidth > 0 then + Dec(FFixedWidth); +end; + +procedure TCustomGrid.RowHeightsChanged; +var + i: Integer; +begin + FGridHeight := 0; + for i := 0 to RowCount - 1 do + Inc(FGridHeight, RowHeights[i] + 1); + if FGridHeight > 0 then + Dec(FGridHeight); + + FFixedHeight := 0; + for i := 0 to FixedRows - 1 do + Inc(FFixedHeight, RowHeights[i] + 1); + if FFixedHeight > 0 then + Dec(FFixedHeight); +end; + +procedure TCustomGrid.SizeChanged(OldColCount, OldRowCount: Integer); +begin + // This dynamic method is only used for descendants of TCustomGrid +end; + + +// private methods + +procedure TCustomGrid.SetColCount(AColCount: Integer); +var + OldColCount, i: Integer; +begin + if AColCount <> FColCount then + begin + OldColCount := FColCount; + FColCount := AColCount; + + ReallocMem(FColWidths, FColCount * SizeOf(Integer)); + for i := OldColCount to FColCount - 1 do + FColWidths^[i] := FDefaultColWidth; + + ScrollingSupport.HorzScrollBar.Max := ColCount - FixedCols - 1; + + ColWidthsChanged; + SizeChanged(OldColCount, FRowCount); + end; +end; + +procedure TCustomGrid.SetRowCount(ARowCount: Integer); +var + OldRowCount, i: Integer; +begin + if ARowCount <> FRowCount then + begin + OldRowCount := FRowCount; + FRowCount := ARowCount; + + ReallocMem(FRowHeights, FRowCount * SizeOf(Integer)); + for i := OldRowCount to FRowCount - 1 do + FRowHeights^[i] := FDefaultRowHeight; + + ScrollingSupport.VertScrollBar.Max := RowCount - FixedRows - 1; + + RowHeightsChanged; + SizeChanged(FColCount, OldRowCount); + end; +end; + +procedure TCustomGrid.SetFixedCols(AFixedCols: Integer); +begin + if AFixedCols <> FixedCols then + begin + FFixedCols := AFixedCols; + ScrollingSupport.HorzScrollBar.Max := ColCount - FixedCols - 1; + end; +end; + +procedure TCustomGrid.SetFixedRows(AFixedRows: Integer); +begin + if AFixedRows <> FixedRows then + begin + FFixedRows := AFixedRows; + ScrollingSupport.VertScrollBar.Max := RowCount - FixedRows - 1; + end; +end; + +procedure TCustomGrid.SetDefaultColWidth(AWidth: Integer); +var + i: Integer; +begin + if AWidth <> FDefaultColWidth then + begin + FDefaultColWidth := AWidth; + for i := 0 to FColCount - 1 do + FColWidths^[i] := AWidth; + ColWidthsChanged; + end; +end; + +procedure TCustomGrid.SetDefaultRowHeight(AHeight: Integer); +var + i: Integer; +begin + if AHeight <> FDefaultRowHeight then + begin + FDefaultRowHeight := AHeight; + for i := 0 to FRowCount - 1 do + FRowHeights^[i] := AHeight; + RowHeightsChanged; + end; +end; + +function TCustomGrid.GetColWidths(ACol: Integer): Integer; +begin + if (ACol < 0) or (ACol >= FColCount) then + raise EInvalidGridOperation(SGridIndexOutOfRange); + Result := FColWidths^[ACol]; +end; + +procedure TCustomGrid.SetColWidths(ACol, AWidth: Integer); +begin + if (ACol < 0) or (ACol >= FColCount) then + raise EInvalidGridOperation(SGridIndexOutOfRange); + FColWidths^[ACol] := AWidth; +end; + +function TCustomGrid.GetRowHeights(ARow: Integer): Integer; +begin + if (ARow < 0) or (ARow >= FRowCount) then + raise EInvalidGridOperation(SGridIndexOutOfRange); + Result := FRowHeights^[ARow]; +end; + +procedure TCustomGrid.SetRowHeights(ARow, AHeight: Integer); +begin + if (ARow < 0) or (ARow >= FRowCount) then + raise EInvalidGridOperation(SGridIndexOutOfRange); + FRowHeights^[ARow] := AHeight; +end; + +procedure TCustomGrid.HorzScrollBarScroll(Sender: TObject; + var APosition: Integer); +var + i, Delta: Integer; + r: TRect; +begin + Delta := 0; + if APosition > ScrollingSupport.HorzScrollBar.Position then + for i := ScrollingSupport.HorzScrollBar.Position to APosition - 1 do + Dec(Delta, ColWidths[i + FixedCols] + 1) + else + for i := APosition to ScrollingSupport.HorzScrollBar.Position - 1 do + Inc(Delta, ColWidths[i + FixedCols] + 1); + + // Scroll the horizontal fixed cells + r := ScrollingSupport.ClientRect; + Inc(r.Left, FixedWidth + 1); + if r.Left <= r.Right then + begin + if Delta < 0 then // Scrolling to the right side + Dec(r.Left, Delta) + else // Scrolling to the left side + Dec(r.Right, Delta); + Scroll(r, Delta, 0); + end; +end; + +procedure TCustomGrid.VertScrollBarScroll(Sender: TObject; + var APosition: Integer); +var + i, Delta: Integer; + r: TRect; +begin + Delta := 0; + if APosition > ScrollingSupport.VertScrollBar.Position then + for i := ScrollingSupport.VertScrollBar.Position to APosition - 1 do + Dec(Delta, RowHeights[i + FixedRows] + 1) + else + for i := APosition to ScrollingSupport.VertScrollBar.Position - 1 do + Inc(Delta, RowHeights[i + FixedRows] + 1); + + // Scroll the grid body + r := ScrollingSupport.ClientRect; + Inc(r.Top, FixedHeight + 1); + if r.Top <= r.Bottom then + begin + if Delta < 0 then // Scrolling downwards + Dec(r.Top, Delta) + else // Scrolling upwards + Dec(r.Bottom, Delta); + Scroll(r, 0, Delta); + end; +end; + + +// ------------------------------------------------------------------- +// TDrawGrid +// ------------------------------------------------------------------- + +procedure TDrawGrid.DrawCell(ACanvas: TFCanvas; ACol, ARow: Integer; + ARect: TRect; + AState: TGridDrawState); +begin + if Assigned(OnDrawCell) then + OnDrawCell(Self, ACanvas, ACol, ARow, ARect, AState); +end; + +function TDrawGrid.CellRect(ACol, ARow: Integer): TRect; +var + i: Integer; +begin + Result.Left := 0; + for i := 0 to ACol - 1 do + Inc(Result.Left, ColWidths[i]); + Result.Right := Result.Left + ColWidths[ACol]; + + Result.Top := 0; + for i := 0 to ARow - 1 do + Inc(Result.Top, RowHeights[i]); + Result.Bottom := Result.Top + RowHeights[ARow]; +end; + + +// ------------------------------------------------------------------- +// TStringGrid +// ------------------------------------------------------------------- + +function TStringGrid.GetCells(ACol, ARow: Integer): String; +begin + if (ACol >= 0) and (ARow >= 0) and (ACol < ColCount) and (ARow < RowCount) then + Result := CellStrings^[ARow * ColCount + ACol] + else + SetLength(Result, 0); +end; + +procedure TStringGrid.SetCells(ACol, ARow: Integer; const AValue: String); +begin + if (ACol >= 0) and (ARow >= 0) and (ACol < ColCount) and (ARow < RowCount) then + CellStrings^[ARow * ColCount + ACol] := AValue; +end; + +procedure TStringGrid.SizeChanged(OldColCount, OldRowCount: Integer); +var + Count: Integer; +begin + inherited SizeChanged(OldColCount, OldRowCount); + ReallocMem(CellStrings, ColCount * RowCount * SizeOf(AnsiString)); + Count := ColCount * RowCount - OldColCount * OldRowCount; + if Count > 0 then + FillChar(CellStrings^[OldColCount * OldRowCount], + Count * SizeOf(AnsiString), #0); +end; + +procedure TStringGrid.DrawCell(ACanvas: TFCanvas; ACol, ARow: Integer; + ARect: TRect; + AState: TGridDrawState); +var + s: String; +begin + // WriteLn('TStringGrid.DrawCell(', ACol, ', ', ARow, ', ', Integer(AState), ');'); + s := Cells[ACol, ARow]; + if Length(s) > 0 then + ACanvas.TextOut(ARect.TopLeft + Point(2, 2), s); + if Assigned(OnDrawCell) then + OnDrawCell(Self, ACanvas, ACol, ARow, ARect, AState); +end; + +constructor TStringGrid.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Self.SizeChanged(0, 0); +end; + +destructor TStringGrid.Destroy; +var + i: Integer; +begin + for i := 0 to RowCount * ColCount - 1 do + CellStrings^[i] := ''; + FreeMem(CellStrings); + inherited Destroy; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/groupbox.inc b/gui/groupbox.inc new file mode 100644 index 00000000..d07cd76c --- /dev/null +++ b/gui/groupbox.inc @@ -0,0 +1,107 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Groupbox class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + { TCustomGroupBox } + + TCustomGroupBox = class(TBinWidget) + protected + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + procedure Resized; override; + public + constructor Create(const pText: string; pOwner: TComponent); overload; + end; + + + TGroupBox = class(TCustomGroupBox) + published + property CanExpandWidth; + property CanExpandHeight; + property Enabled; + property Text; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + + +// =================================================================== +// TCustomGroupBox +// =================================================================== + +procedure TCustomGroupBox.Paint(Canvas: TFCanvas); +begin + Style.DrawGroupBox(Canvas, Rect(0, 0, Width, Height), Text, WidgetState); +end; + + +procedure TCustomGroupBox.CalcSizes; +var + Borders: TRect; + LabelWidth: Integer; +begin + Borders := Style.GetGroupBoxBorders(TFCanvas(FindForm.Wnd.Canvas), Text, LabelWidth); + FMinSize.cx := Borders.Left + Borders.Right + LabelWidth; + FMinSize.cy := Borders.Top + Borders.Bottom; + if Assigned(Child) then + begin + if Child.MinSize.cx > LabelWidth then + FMinSize.cx := Borders.Left + Borders.Right + Child.MinSize.cx; + Inc(FMinSize.cy, Child.MinSize.cy); + if Child.DefSize.cx > LabelWidth then + FDefSize.cx := Borders.Left + Borders.Right + Child.MinSize.cx; + Inc(FDefSize.cy, Child.DefSize.cy); + if Child.MaxSize.cx > LabelWidth then + FMaxSize.cx := Min(Borders.Left + Borders.Right + Child.MaxSize.cx, InfiniteSize); + FMaxSize.cy := Min(MaxSize.cy + Child.MaxSize.cy, InfiniteSize); + end; +end; + + +procedure TCustomGroupBox.Resized; +var + LabelWidth: Integer; + Borders: TRect; +begin + if Assigned(Child) then + begin + Borders := Style.GetGroupBoxBorders(TFCanvas(FindForm.Wnd.Canvas), Text, LabelWidth); + Child.SetBounds(Borders.TopLeft, Size(Width - Borders.Left - Borders.Right, + Height - Borders.Top - Borders.Bottom)); + end; +end; + + +constructor TCustomGroupBox.Create(const pText: string; pOwner: TComponent); +begin + Create(pOwner); + Text := pText; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/label.inc b/gui/label.inc new file mode 100644 index 00000000..e9a948aa --- /dev/null +++ b/gui/label.inc @@ -0,0 +1,113 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Label class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + + { TCustomLabel } + + TCustomLabel = class(TWidget) + private + FFontColor: TColor; + procedure SetAlignment(AAlignment: TAlignment); + procedure SetFontColor(const AValue: TColor); + protected + FAlignment: TAlignment; + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + property Alignment: TAlignment read FAlignment write SetAlignment; + property FontColor: TColor read FFontColor write SetFontColor; + public + constructor Create(const pText: string; pOwner: TComponent); overload; + end; + + + TLabel = class(TCustomLabel) + public + published + property CanExpandWidth; + property Enabled; + property FontColor; + property Text; + property Alignment default taLeftJustify; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + +// =================================================================== +// TCustomLabel +// =================================================================== + +procedure TCustomLabel.Paint(Canvas: TFCanvas); +var + x: Integer; +begin + Canvas.SetColor(Style.GetUIColor(FFontColor)); +// Canvas.SetColor(FFontColor); + case Alignment of + taLeftJustify: x := 0; + taCenter: x := (BoundsSize.cx - Canvas.TextWidth(Text)) div 2; + taRightJustify: x := BoundsSize.cx - Canvas.TextWidth(Text); + end; + Style.DrawText(Canvas, Point(x, + (BoundsSize.cy - Canvas.FontCellHeight) div 2), Text, WidgetState); +end; + + +procedure TCustomLabel.CalcSizes; +begin + with FindForm.Wnd.Canvas do + FMinSize := gfxbase.Size(TextWidth(Text), FontCellHeight); +end; + + +constructor TCustomLabel.Create(const pText: string; pOwner: TComponent); +begin + Create(pOwner); + Text := pText; + FFontColor := clWindowText; +end; + + +procedure TCustomLabel.SetAlignment(AAlignment: TAlignment); +begin + if AAlignment <> Alignment then + begin + FAlignment := AAlignment; + Redraw; + end; +end; + + +procedure TCustomLabel.SetFontColor(const AValue: TColor); +begin + if FFontColor = AValue then exit; + FFontColor := AValue; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/layouts.inc b/gui/layouts.inc new file mode 100644 index 00000000..9f2f3bb0 --- /dev/null +++ b/gui/layouts.inc @@ -0,0 +1,1045 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Layout class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + +// =================================================================== +// Layouts +// =================================================================== + +type + + ELayoutError = class(Exception); + + THorzAlign = (horzLeft, horzCenter, horzRight, horzFill); + TVertAlign = (vertTop, vertCenter, vertBottom, vertFill); + + TLayoutItem = class(TCollectionItem) + private + FWidget: TWidget; + published + property Widget: TWidget read FWidget write FWidget; + end; + + TWidgetArrayInfo = record + min, def, max: Integer; + MinFlag, MaxFlag: Boolean; + end; + + TWidgetArrayInfoArray = array[0..(1 shl 30) div SizeOf(TWidgetArrayInfo) - 1] of TWidgetArrayInfo; + PWidgetArrayInfoArray = ^TWidgetArrayInfoArray; + + + TLayout = class(TContainerWidget) + protected + FWidgets: TCollection; + FBorderSpacing: Integer; + IsRecalcingLayout: Boolean; + function GetChildCount: Integer; override; + function GetChild(Index: Integer): TWidget; override; + procedure AddFixedChild(AChild: TWidget); + property BorderSpacing: Integer read FBorderSpacing write FBorderSpacing; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function ContainsChild(AChild: TWidget): Boolean; override; + end; + + +// ------------------------------------------------------------------- +// FixedLayout +// ------------------------------------------------------------------- + + TFixedItem = class(TLayoutItem) + public + Left: Integer; + Top: Integer; + end; + + + { TFixedLayout } + + TFixedLayout = class(TLayout) + protected + procedure CalcSizes; override; + public + constructor Create(AOwner: TComponent); override; + procedure AddWidget(AWidget: TWidget; ALeft, ATop: Integer); + procedure MoveWidget(AWidget: TWidget; ALeft, ATop: Integer); + published + property Enabled; + end; + + +// ------------------------------------------------------------------- +// DockingLayout +// ------------------------------------------------------------------- + + TDockingMode = (dmTop, dmBottom, dmLeft, dmRight, dmClient, dmUndocked); + + TDockingItem = class(TLayoutItem) + public + Left, Top: Integer; + DockingMode: TDockingMode; + end; + + + TDockingLayout = class(TLayout) + protected + procedure CalcSizes; override; + public + constructor Create(AOwner: TComponent); override; + procedure AddWidget(AWidget: TWidget; ADockingMode: TDockingMode); + procedure AddWidget(AWidget: TWidget; ALeft, ATop: Integer); + published + property Enabled; + end; + + +// ------------------------------------------------------------------- +// BoxLayout +// ------------------------------------------------------------------- + + TCustomBoxLayout = class(TLayout) + private + FHorzAlign: THorzAlign; + FVertAlign: TVertAlign; + FOrientation: TOrientation; + FSpacing: Integer; + procedure SetOrientation(AOrientation: TOrientation); + protected + procedure CalcSizes; override; + procedure Resized; override; + property HorzAlign: THorzAlign read FHorzAlign write FHorzAlign default horzFill; + property VertAlign: TVertAlign read FVertAlign write FVertAlign default vertFill; + property Orientation: TOrientation read FOrientation write SetOrientation default Horizontal; + property Spacing: Integer read FSpacing write FSpacing default 4; + public + constructor Create(AOwner: TComponent); override; + procedure InsertChild(AChild: TWidget); override; + procedure RemoveChild(AChild: TWidget); override; + end; + + + TBoxLayout = class(TCustomBoxLayout) + published + property CanExpandWidth; + property CanExpandHeight; + property Enabled; + property BorderSpacing; + property HorzAlign; + property Orientation; + property Spacing; + property VertAlign; + end; + + +// ------------------------------------------------------------------- +// GridLayout +// ------------------------------------------------------------------- + + TGridItem = class(TLayoutItem) + private + FX, FY, FWidth, FHeight: Integer; + public + constructor Create(ACollection: TCollection); override; + published + property x: Integer read FX write FX default 1; + property y: Integer read FY write FY default 1; + property Width: Integer read FWidth write FWidth; + property Height: Integer read FHeight write FHeight; + end; + + + { TCustomGridLayout } + + TCustomGridLayout = class(TLayout) + private + FColCount: Integer; + FRowCount: Integer; + FColSpacing: Integer; + FRowSpacing: Integer; +// FWidgets: TCollection; + procedure SetColCount(AColCount: Integer); + procedure SetRowCount(ARowCount: Integer); + procedure SetColSpacing(AColSpacing: Integer); + procedure SetRowSpacing(ARowSpacing: Integer); + protected + procedure InitSizeInfos(var ColInfos, RowInfos: PWidgetArrayInfoArray); + procedure CalcSizes; override; + procedure Resized; override; + property GridPositions: TCollection read FWidgets write FWidgets; + property ColCount: Integer read FColCount write SetColCount default 2; + property RowCount: Integer read FRowCount write SetRowCount default 2; + property ColSpacing: Integer read FColSpacing write SetColSpacing default 4; + property RowSpacing: Integer read FRowSpacing write SetRowSpacing default 4; + public + constructor Create(AOwner: TComponent); override; + procedure AddWidget(AWidget: TWidget; x, y, w, h: Integer); + procedure MoveWidget(AWidget: TWidget; x, y, w, h: Integer); + end; + + + TGridLayout = class(TCustomGridLayout) + published + property Enabled; + property ColCount; + property RowCount; + property ColSpacing; + property RowSpacing; + property GridPositions; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +// =================================================================== +// Common layout widgets implementation +// =================================================================== + +resourcestring + SLayoutWidgetNotFound = 'Layout child widget not found'; + + +procedure AddToSizes(infos: PWidgetArrayInfoArray; count: Integer; TooMuch: Integer); +var + i, add, FoundElements: Integer; +begin + while TooMuch > 0 do + begin + add := TooMuch; + FoundElements := 0; + for i := 0 to count - 1 do + begin + if not infos^[i].MaxFlag then + continue; + Inc(FoundElements); + if infos^[i].def + add > infos^[i].max then + add := infos^[i].max - infos^[i].def; + end; + if FoundElements > 0 then + begin + add := add div FoundElements; + if add <= 0 then + add := 1; + end else + break; + + for i := 0 to count - 1 do + begin + if not infos^[i].MaxFlag then + continue; + Inc(infos^[i].def, add); + Dec(TooMuch, add); + if TooMuch = 0 then + exit; + if infos^[i].def = infos^[i].max then + infos^[i].MaxFlag := False; + end; + end; +end; + +procedure SubFromSizes(infos: PWidgetArrayInfoArray; count: Integer; TooMuch: Integer); +var + i, sub, FoundElements: Integer; +begin + while TooMuch > 0 do + begin + sub := TooMuch; + FoundElements := 0; + for i := 0 to count - 1 do + begin + if not infos^[i].MinFlag then + continue; + Inc(FoundElements); + if infos^[i].def - sub < infos^[i].min then + sub := infos^[i].def - infos^[i].min; + end; + if FoundElements > 0 then + begin + sub := sub div FoundElements; + if sub <= 0 then + sub := 1; + end else + break; + + for i := 0 to count - 1 do + begin + if not infos^[i].MinFlag then + continue; + Dec(infos^[i].def, sub); + Dec(TooMuch, sub); + if TooMuch = 0 then + exit; + if infos^[i].def = infos^[i].min then + infos^[i].MinFlag := False; + end; + end; +end; + +procedure CorrectSizes(infos: PWidgetArrayInfoArray; count: Integer; SizeDiff: Integer); +var + TooMuch: Integer; +begin + TooMuch := SizeDiff; + if TooMuch > 0 then + AddToSizes(infos, count, TooMuch) + else if TooMuch < 0 then + SubFromSizes(infos, count, -TooMuch); +end; + + +// ------------------------------------------------------------------- +// TLayout +// ------------------------------------------------------------------- + +// public methods + +constructor TLayout.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FCanExpandWidth := True; + FCanExpandHeight := True; +end; + + +destructor TLayout.Destroy; +begin + FWidgets.Free; + inherited Destroy; +end; + + +function TLayout.ContainsChild(AChild: TWidget): Boolean; +var + i: Integer; +begin + for i := 0 to FWidgets.Count - 1 do + if TLayoutItem(FWidgets.Items[i]).Widget = AChild then + begin + Result := True; + exit; + end; + Result := False; +end; + + +// protected methods + +procedure TLayout.AddFixedChild(AChild: TWidget); +begin +end; + +function TLayout.GetChildCount: Integer; +begin + Result := FWidgets.Count; +end; + +function TLayout.GetChild(Index: Integer): TWidget; +begin + Result := TLayoutItem(FWidgets.Items[Index]).Widget; +end; + + +// ------------------------------------------------------------------- +// TFixedLayout +// ------------------------------------------------------------------- + +constructor TFixedLayout.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FWidgets := TCollection.Create(TFixedItem); +end; + +procedure TFixedLayout.AddWidget(AWidget: TWidget; ALeft, ATop: Integer); +var + item: TFixedItem; +begin + AWidget.Parent := Self; + item := TFixedItem(FWidgets.Add); + item.Left := ALeft; + item.Top := ATop; + item.Widget := AWidget; + AWidget.SetBounds(Point(item.Left, item.Top), item.Widget.DefSize); + AddFixedChild(AWidget); +end; + +procedure TFixedLayout.MoveWidget(AWidget: TWidget; ALeft, ATop: Integer); +var + i: integer; + item: TFixedItem; +begin + for i := 0 to FWidgets.Count - 1 do + begin + item := TFixedItem(FWidgets.Items[i]); + if item.Widget = AWidget then + begin + item.Left := ALeft; + item.Top := ATop; + AWidget.SetBounds(Point(item.Left, item.Top), item.Widget.DefSize); + exit; + end; + end; + raise ELayoutError.Create(SLayoutWidgetNotFound); +end; + +procedure TFixedLayout.CalcSizes; +var + i: Integer; + item: TFixedItem; +begin + if FWidgets.Count = 0 then + FDefSize := gfxbase.Size(50, 50) + else + for i := 0 to FWidgets.Count - 1 do + begin + item := TFixedItem(FWidgets.Items[i]); + FDefSize.cx := Max(DefSize.cx, item.Left + item.Widget.DefSize.cx); + FDefSize.cy := Max(DefSize.cx, item.Top + item.Widget.DefSize.cy); + end; +end; + +{procedure TFixedLayout.EvLayoutChildren(Canvas: TGfxCanvas); +var + i: Integer; + item: TFixedItem; +begin + for i := 0 to FWidgets.Count - 1 do + begin + item := TFixedItem(FWidgets.Items[i]); + item.Widget.SetBounds(item.Left, item.Top, item.Widget.DefSize.cx, item.Widget.DefSize.cy); + end; +end;} + + +// ------------------------------------------------------------------- +// TDockingLayout +// ------------------------------------------------------------------- + +constructor TDockingLayout.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FWidgets := TCollection.Create(TDockingItem); +end; + +procedure TDockingLayout.CalcSizes; +var + i: Integer; + item: TDockingItem; + w, cw: TWidget; +begin + if FWidgets.Count = 0 then + begin + FDefSize := gfxbase.Size(200, 200); + exit; + end; + + // Find the client widget (widget with DockingMode "dmClient") + cw := nil; + for i := 0 to FWidgets.Count - 1 do + begin + item := TDockingItem(FWidgets.Items[i]); + if item.DockingMode = dmClient then + begin + cw := item.Widget; + break; + end; + end; + + if Assigned(cw) then + begin + FMinSize := cw.MinSize; + FMaxSize := cw.MaxSize; + FDefSize := cw.DefSize; + end else + FDefSize := gfxbase.Size(200, 200); + + for i := 0 to FWidgets.Count - 1 do + begin + item := TDockingItem(FWidgets.Items[i]); + w := item.Widget; + case item.DockingMode of + dmTop, dmBottom: + begin + if MinSize.cx < w.MinSize.cx then + FMinSize.cx := w.MinSize.cx; + Inc(FMinSize.cy, w.MinSize.cy); + if MaxSize.cx < w.MaxSize.cx then + FMaxSize.cx := w.MaxSize.cx; + if MaxSize.cy < InfiniteSize then + Inc(FMaxSize.cy, w.MaxSize.cy); + if DefSize.cx < w.DefSize.cx then + FDefSize.cx := w.DefSize.cx; + Inc(FDefSize.cy, w.DefSize.cy); + end; + dmLeft, dmRight: + begin + Inc(FMinSize.cx, w.MinSize.cx); + if MinSize.cy < w.MinSize.cy then + FMinSize.cy := w.MinSize.cy; + if MaxSize.cx < InfiniteSize then + Inc(FMaxSize.cx, w.MaxSize.cx); + if MaxSize.cy < w.MaxSize.cy then + FMaxSize.cy := w.MaxSize.cy; + Inc(FDefSize.cx, w.DefSize.cx); + if DefSize.cy < w.DefSize.cy then + FDefSize.cy := w.DefSize.cy; + end; + end; + end; +end; + + +{procedure TDockingLayout.EvLayoutChildren(Canvas: TGfxCanvas); +var + clx, cly, clw, clh: Integer; // Client rectangle + ClientWidget: TWidget; + i, WidgetW, WidgetH: Integer; + item: TDockingItem; +begin + clx := 0; + cly := 0; + clw := BoundsSize.cx; + clh := BoundsSize.cy; + // WriteLn('=> DockingLayout.EvLayoutChildren ', BoundsSize.cx, ' x ', BoundsSize.cy); + if (clw = 0) or (clh = 0) then + exit; + + // Process all attached widgets + ClientWidget := nil; + for i := 0 to FWidgets.Count - 1 do + begin + item := TDockingItem(FWidgets.Items[i]); + case item.DockingMode of + dmLeft: + begin + WidgetW := item.Widget.DefSize.cx; + WidgetH := clh; + item.Left := clx; + item.Top := cly; + Inc(clx, WidgetW); + Dec(clw, WidgetW); + end; + dmTop: + begin + WidgetW := clw; + WidgetH := item.Widget.DefSize.cy; + item.Left := clx; + item.Top := cly; + Inc(cly, WidgetH); + Dec(clh, WidgetH); + end; + dmRight: + begin + WidgetW := item.Widget.DefSize.cx; + WidgetH := clh; + item.Left := clx + clw - WidgetW; + item.Top := cly; + Dec(clw, WidgetW); + end; + dmBottom: + begin + WidgetH := item.Widget.DefSize.cy; + WidgetW := clw; + item.Left := clx; + item.Top := cly + clh - WidgetH; + Dec(clh, WidgetH); + end; + dmClient: + ClientWidget := item.Widget; + end; + if item.DockingMode <> dmClient then + item.Widget.SetBounds(item.Left, item.Top, WidgetW, WidgetH); + end; + if Assigned(ClientWidget) then + ClientWidget.SetBounds(clx, cly, clw, clh); +end;} + +procedure TDockingLayout.AddWidget(AWidget: TWidget; ADockingMode: TDockingMode); +var + item: TDockingItem; +begin + AWidget.Parent := Self; + item := TDockingItem(FWidgets.Add); + item.Widget := AWidget; + item.DockingMode := ADockingMode; + AddFixedChild(AWidget); +end; + +procedure TDockingLayout.AddWidget(AWidget: TWidget; ALeft, ATop: Integer); +var + item: TDockingItem; +begin + AWidget.Parent := Self; + item := TDockingItem(FWidgets.Add); + item.Widget := AWidget; + item.DockingMode := dmUndocked; + item.Left := ALeft; + item.Top := ATop; + AddFixedChild(AWidget); +end; + + +// ------------------------------------------------------------------- +// TCustomBoxLayout +// ------------------------------------------------------------------- + +procedure TCustomBoxLayout.SetOrientation(AOrientation: TOrientation); +begin + if AOrientation <> FOrientation then + begin + FOrientation := AOrientation; + Update; + end; +end; + + +constructor TCustomBoxLayout.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FWidgets := TCollection.Create(TLayoutItem); + FOrientation := Horizontal; + FHorzAlign := horzFill; + FVertAlign := vertFill; + FSpacing := 4; +end; + + +procedure TCustomBoxLayout.InsertChild(AChild: TWidget); +var + item: TLayoutItem; +begin + if not ContainsChild(AChild) then + begin + item := TLayoutItem(FWidgets.Add); + item.Widget := AChild; + AChild.Parent := Self; + end; +end; + + +procedure TCustomBoxLayout.RemoveChild(AChild: TWidget); +begin + {$Warning Not implemented yet.} + raise Exception.Create('TCustomBoxLayout.RemoveChild - Not implemented yet'); +end; + + +procedure TCustomBoxLayout.CalcSizes; +var + i: Integer; + item: TLayoutItem; +begin + i := (FWidgets.Count - 1) * FSpacing; + if Orientation = Horizontal then + begin + FMinSize := Size(i, 0); + FDefSize := MinSize; + if HorzAlign = horzFill then + FMaxSize.cx := i + else + FMaxSize.cx := InfiniteSize; + FMaxSize.cy := InfiniteSize; + end else + begin + FMinSize := Size(0, i); + FDefSize := MinSize; + FMaxSize.cx := InfiniteSize; + if VertAlign = vertFill then + FMaxSize.cy := i + else + FMaxSize.cy := InfiniteSize; + end; + + for i := 0 to FWidgets.Count - 1 do + begin + item := TLayoutItem(FWidgets.Items[i]); + if Orientation = Horizontal then + begin + Inc(FMinSize.cx, item.Widget.MinSize.cx); + Inc(FDefSize.cx, item.Widget.DefSize.cx); + FMaxSize.cx := Min(InfiniteSize, MaxSize.cx + item.Widget.MaxSize.cx); + FMaxSize.cy := Min(MaxSize.cy, item.Widget.MaxSize.cy); + if MinSize.cy < item.Widget.MinSize.cy then + FMinSize.cy := item.Widget.MinSize.cy; + if DefSize.cy < item.Widget.DefSize.cy then + FDefSize.cy := item.Widget.DefSize.cy; + if MaxSize.cy > item.Widget.MaxSize.cy then + FMaxSize.cy := item.Widget.MaxSize.cy; + end else + begin + Inc(FMinSize.cy, item.Widget.MinSize.cy); + Inc(FDefSize.cy, item.Widget.DefSize.cy); + FMaxSize.cx := Min(MaxSize.cx, item.Widget.MaxSize.cx); + FMaxSize.cy := Min(InfiniteSize, MaxSize.cy + item.Widget.MaxSize.cy); + if MinSize.cx < item.Widget.MinSize.cx then + FMinSize.cx := item.Widget.MinSize.cx; + if DefSize.cx < item.Widget.DefSize.cx then + FDefSize.cx := item.Widget.DefSize.cx; + if MaxSize.cx > item.Widget.MaxSize.cx then + FMaxSize.cx := item.Widget.MaxSize.cx; + end; + end; + + Inc(FMinSize.cx, 2 * FBorderSpacing); + Inc(FMinSize.cy, 2 * FBorderSpacing); + Inc(FDefSize.cx, 2 * FBorderSpacing); + Inc(FDefSize.cy, 2 * FBorderSpacing); + FMaxSize.cx := Min(InfiniteSize, MaxSize.cx + 2 * FBorderSpacing); + FMaxSize.cy := Min(InfiniteSize, MaxSize.cy + 2 * FBorderSpacing); +end; + +procedure TCustomBoxLayout.Resized; +var + sizes: PWidgetArrayInfoArray; + i, x, y, xpos, ypos, w, h, sum: Integer; + item: TLayoutItem; +begin + GetMem(sizes, FWidgets.Count * SizeOf(TWidgetArrayInfo)); + + for i := 0 to FWidgets.Count - 1 do + begin + sizes^[i].min := 0; + sizes^[i].def := 0; + sizes^[i].max := InfiniteSize; + sizes^[i].MinFlag := True; + sizes^[i].MaxFlag := True; + end; + + if Orientation = Horizontal then + for i := 0 to FWidgets.Count - 1 do + begin + item := TLayoutItem(FWidgets.Items[i]); + sizes^[i].min := Max(sizes^[i].min, item.Widget.MinSize.cx); + sizes^[i].def := Max(sizes^[i].def, item.Widget.DefSize.cx); + sizes^[i].max := Min(sizes^[i].max, item.Widget.MaxSize.cx); + end + else + for i := 0 to FWidgets.Count - 1 do + begin + item := TLayoutItem(FWidgets.Items[i]); + sizes^[i].min := Max(sizes^[i].min, item.Widget.MinSize.cy); + sizes^[i].def := Max(sizes^[i].def, item.Widget.DefSize.cy); + sizes^[i].max := Min(sizes^[i].max, item.Widget.MaxSize.cy); + end; + + for i := 0 to FWidgets.Count - 1 do + begin + if sizes^[i].def = 0 then sizes^[i].def := 20; + if sizes^[i].min >= sizes^[i].def then + sizes^[i].MinFlag := False; + if sizes^[i].max <= sizes^[i].def then + sizes^[i].MaxFlag := False; + end; + + if Orientation = Horizontal then + begin + if FHorzAlign = horzFill then + CorrectSizes(sizes, FWidgets.Count, BoundsSize.cx - DefSize.cx) + end else + if FVertAlign = vertFill then + CorrectSizes(sizes, FWidgets.Count, BoundsSize.cy - DefSize.cy); + + sum := (FWidgets.Count - 1) * FSpacing; + for i := 0 to FWidgets.Count - 1 do + Inc(sum, sizes^[i].def); + + if Orientation = Horizontal then + case FHorzAlign of + horzCenter: x := (BoundsSize.cx - sum) div 2; + horzRight: x := BoundsSize.cx - FBorderSpacing - sum; + else x := FBorderSpacing; + end + else + case FVertAlign of + vertCenter: y := (BoundsSize.cy - sum) div 2; + vertBottom: y := BoundsSize.cy - FBorderSpacing - sum; + else y := FBorderSpacing; + end; + + for i := 0 to FWidgets.Count - 1 do + begin + item := TLayoutItem(FWidgets.Items[i]); + if Orientation = Horizontal then + begin + xpos := x; + w := sizes^[i].def; + h := Min(BoundsSize.cy, item.Widget.DefSize.cy); + case FVertAlign of + vertCenter: ypos := (BoundsSize.cy - h) div 2; + vertBottom: ypos := BoundsSize.cy - FBorderSpacing - h; + else ypos := FBorderSpacing; + end; + Inc(x, sizes^[i].def + FSpacing); + if FVertAlign = vertFill then + h := Min(BoundsSize.cy, item.Widget.MaxSize.cy); + end + else + begin + ypos := y; + w := Min(BoundsSize.cx, item.Widget.DefSize.cx); + h := sizes^[i].def; + case FHorzAlign of + horzCenter: xpos := (BoundsSize.cx - w) div 2; + horzRight : xpos := BoundsSize.cx - FBorderSpacing - w; + else xpos := FBorderSpacing; + end; + Inc(y, sizes^[i].def + FSpacing); + if FHorzAlign = horzFill then + w := Min(BoundsSize.cx, item.Widget.MaxSize.cx); + end; + item.Widget.SetBounds(Point(xpos, ypos), gfxbase.Size(w, h)); + end; + + FreeMem(sizes); +end; + + +// ------------------------------------------------------------------- +// TCustomGridLayout +// ------------------------------------------------------------------- + +constructor TGridItem.Create(ACollection: TCollection); +begin + inherited Create(ACollection); + Width := 1; + Height := 1; +end; + + +procedure TCustomGridLayout.SetColCount(AColCount: Integer); +begin + if AColCount <> FColCount then + begin + FColCount := AColCount; + Update; + end; +end; + + +procedure TCustomGridLayout.SetRowCount(ARowCount: Integer); +begin + if ARowCount <> FRowCount then + begin + FRowCount := ARowCount; + Update; + end; +end; + + +procedure TCustomGridLayout.SetColSpacing(AColSpacing: Integer); +begin + if AColSpacing <> FColSpacing then + begin + FColSpacing := AColSpacing; + Update; + end; +end; + + +procedure TCustomGridLayout.SetRowSpacing(ARowSpacing: Integer); +begin + if ARowSpacing <> FRowSpacing then + begin + FRowSpacing := ARowSpacing; + Update; + end; +end; + + +procedure TCustomGridLayout.InitSizeInfos(var ColInfos, RowInfos: PWidgetArrayInfoArray); +var + i: Integer; + item: TGridItem; +begin + GetMem(ColInfos, FColCount * SizeOf(TWidgetArrayInfo)); + GetMem(RowInfos, FRowCount * SizeOf(TWidgetArrayInfo)); + + for i := 0 to FColCount - 1 do + begin + ColInfos^[i].min := 0; + ColInfos^[i].def := 0; + ColInfos^[i].max := InfiniteSize; + ColInfos^[i].MinFlag := True; + ColInfos^[i].MaxFlag := True; + end; + + for i := 0 to FRowCount - 1 do + begin + RowInfos^[i].min := 0; + RowInfos^[i].def := 0; + RowInfos^[i].max := InfiniteSize; + RowInfos^[i].MinFlag := True; + RowInfos^[i].MaxFlag := True; + end; + + for i := 0 to FWidgets.Count - 1 do + begin + item := TGridItem(FWidgets.Items[i]); + ColInfos^[item.x].min := Max(ColInfos^[item.x].min, item.Widget.MinSize.cx); + ColInfos^[item.x].def := Max(ColInfos^[item.x].def, item.Widget.DefSize.cx); + ColInfos^[item.x].max := Min(ColInfos^[item.x].max, item.Widget.MaxSize.cx); + RowInfos^[item.y].min := Max(RowInfos^[item.y].min, item.Widget.MinSize.cy); + RowInfos^[item.y].def := Max(RowInfos^[item.y].def, item.Widget.DefSize.cy); + RowInfos^[item.y].max := Min(RowInfos^[item.y].max, item.Widget.MaxSize.cy); + end; + + for i := 0 to FColCount - 1 do + begin + if ColInfos^[i].def = 0 then + ColInfos^[i].def := 20; + if ColInfos^[i].min >= ColInfos^[i].def then + ColInfos^[i].MinFlag := False; + if ColInfos^[i].max <= ColInfos^[i].def then + ColInfos^[i].MaxFlag := False; + end; + + for i := 0 to FRowCount - 1 do + begin + if RowInfos^[i].def = 0 then + RowInfos^[i].def := 20; + if RowInfos^[i].min >= RowInfos^[i].def then + RowInfos^[i].MinFlag := False; + if RowInfos^[i].max <= RowInfos^[i].def then + RowInfos^[i].MaxFlag := False; + end; +end; + + +procedure TCustomGridLayout.CalcSizes; +var + ColInfos, RowInfos: PWidgetArrayInfoArray; + i: Integer; +begin + MinSize.cx := (FColCount - 1) * FColSpacing; + MinSize.cy := (FRowCount - 1) * FRowSpacing; + DefSize.cx := (FColCount - 1) * FColSpacing; + DefSize.cy := (FRowCount - 1) * FRowSpacing; + MaxSize.cx := (FColCount - 1) * FColSpacing; + MaxSize.cy := (FRowCount - 1) * FRowSpacing; + + InitSizeInfos(ColInfos, RowInfos); + + for i := 0 to FColCount - 1 do + begin + Inc(FMinSize.cx, ColInfos^[i].min); + Inc(FDefSize.cx, ColInfos^[i].def); + FMaxSize.cx := Min(InfiniteSize, MaxSize.cx + ColInfos^[i].max); + end; + + for i := 0 to FRowCount - 1 do + begin + Inc(FMinSize.cy, RowInfos^[i].min); + Inc(FDefSize.cy, RowInfos^[i].def); + FMaxSize.cy := Min(InfiniteSize, MaxSize.cy + RowInfos^[i].max); + end; + + FreeMem(RowInfos); + FreeMem(ColInfos); +end; + + +procedure TCustomGridLayout.Resized; +var + ColInfos, RowInfos: PWidgetArrayInfoArray; + i, j, x, y, w, h: Integer; + item: TGridItem; +begin + InitSizeInfos(ColInfos, RowInfos); + + CorrectSizes(ColInfos, FColCount, BoundsSize.cx - DefSize.cx); + CorrectSizes(RowInfos, FRowCount, BoundsSize.cy - DefSize.cy); + + for i := 0 to FWidgets.Count - 1 do + begin + item := TGridItem(FWidgets.Items[i]); + x := 0; + for j := 0 to item.x - 1 do + Inc(x, ColInfos^[j].def); + y := 0; + for j := 0 to item.y - 1 do + Inc(y, RowInfos^[j].def); + w := 0; + for j := 0 to item.Width - 1 do + Inc(w, ColInfos^[item.x + j].def); + h := 0; + for j := 0 to item.Height - 1 do + Inc(h, RowInfos^[item.y + j].def); + Inc(w, (item.Width - 1) * FColSpacing); + Inc(h, (item.Height - 1) * FRowSpacing); + item.Widget.SetBounds(Point(x + item.x * FColSpacing, + y + item.y * FRowSpacing), gfxbase.Size(w, h)); + end; + + FreeMem(ColInfos); + FreeMem(RowInfos); +end; + +constructor TCustomGridLayout.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FWidgets := TCollection.Create(TGridItem); + FColCount := 2; + FRowCount := 2; + FColSpacing := 4; + FRowSpacing := 4; +end; + +procedure TCustomGridLayout.AddWidget(AWidget: TWidget; x, y, w, h: Integer); +var + item: TGridItem; +begin + AWidget.Parent := Self; + item := TGridItem(FWidgets.Add); + item.Widget := AWidget; + item.x := x; + item.y := y; + item.Width := w; + item.Height := h; +end; + +procedure TCustomGridLayout.MoveWidget(AWidget: TWidget; x, y, w, h: Integer); +var + i: integer; + item: TGridItem; +begin + for i := 0 to FWidgets.Count - 1 do + begin + item := TGridItem(FWidgets.Items[i]); + if item.Widget = AWidget then + begin + item.x := x; + item.y := y; + item.Width := w; + item.Height := h; + Update; + exit; + end; + end; + raise ELayoutError.Create(SLayoutWidgetNotFound); +end; + + +{$ENDIF read_implementation} + diff --git a/gui/listbox.inc b/gui/listbox.inc new file mode 100644 index 00000000..07a29c97 --- /dev/null +++ b/gui/listbox.inc @@ -0,0 +1,329 @@ +{%mainunit fpgui.pp} + +{ Listbox widget implementation } + +{$IFDEF read_interface} + + TCustomListBox = class(TWidget) + private + FHotTrack: Boolean; + FItems: TStrings; + FItemIndex: Integer; + function EvMousePressed(Event: TMousePressedEventObj): Boolean; + function EvMouseReleased(Event: TMouseReleasedEventObj): Boolean; + function EvMouseMoved(Event: TMouseMoveEventObj): Boolean; + function ProcessMouseEvent(Event: TMouseEventObj): Boolean; + protected + ScrollingSupport: TScrollingSupport; + FMaxItemWidth: Integer; + ItemHeight: Integer; + procedure Paint(Canvas: TFCanvas); override; + function ProcessEvent(Event: TEventObj): Boolean; override; + function DistributeEvent(Event: TEventObj): Boolean; override; +// procedure EvKeyPressed(Key: Word; Shift: TShiftState); override; + procedure CalcSizes; override; + procedure Resized; override; + procedure RecalcWidth; + procedure UpdateScrollBars; + procedure RedrawItem(AIndex: Integer); + property CanExpandWidth default True; + property CanExpandHeight default True; + property HotTrack: Boolean read FHotTrack write FHotTrack default False; + property ItemIndex: Integer read FItemIndex write FItemIndex default -1; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property Items: TStrings read FItems write FItems; + end; + + + TListBox = class(TCustomListBox) + published + // TWidget properties + property OnClick; + property Enabled; + // TCustomListBox properties + property HotTrack; + property Items; + property ItemIndex; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +// =================================================================== +// TListBoxStrings +// =================================================================== + +type + + TListBoxStrings = class(TStringList) + protected + ListBox: TCustomListBox; + procedure SetUpdateState(Updating: Boolean); override; + public + constructor Create(AListBox: TCustomListBox); + function Add(const s: String): Integer; override; + end; + + +constructor TListBoxStrings.Create(AListBox: TCustomListBox); +begin + inherited Create; + ListBox := AListBox; +end; + +function TListBoxStrings.Add(const s: String): Integer; +var + ItemWidth: Integer; +begin + Result := inherited Add(s); + if Assigned(ListBox.FindForm) and Assigned(ListBox.FindForm.Wnd) then + begin + ItemWidth := ListBox.FindForm.Wnd.Canvas.TextWidth(s) + 4; + if ItemWidth > ListBox.FMaxItemWidth then + ListBox.FMaxItemWidth := ItemWidth; + ListBox.UpdateScrollBars; + end; +end; + +procedure TListBoxStrings.SetUpdateState(Updating: Boolean); +begin + if not Updating then + ListBox.RecalcWidth; +end; + + +// =================================================================== +// TCustomListBox +// =================================================================== + +constructor TCustomListBox.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WidgetStyle := WidgetStyle + [wsCaptureMouse, wsClickable, wsOpaque]; + FCanExpandWidth := True; + FCanExpandHeight := True; + + ScrollingSupport := TScrollingSupport.Create(Self); + ScrollingSupport.HorzScrollBar.OnScroll := + @ScrollingSupport.DefHorzScrollHandler; + ScrollingSupport.VertScrollBar.OnScroll := + @ScrollingSupport.DefVertScrollHandler; + Items := TListBoxStrings.Create(Self); + FItemIndex := -1; + UpdateScrollBars; +end; + +destructor TCustomListBox.Destroy; +begin + Items.Free; + ScrollingSupport.Free; + inherited Destroy; +end; + + +// protected methods + +procedure TCustomListBox.Paint(Canvas: TFCanvas); +var + i, StartIndex, EndIndex: Integer; + ItemRect: TRect; + ItemFlags: TItemFlags; +begin + inherited Paint(Canvas); + + if not Canvas.IntersectClipRect(ScrollingSupport.ClientRect) then + exit; + + Style.SetUIColor(Canvas, clWindow); +// Style.DrawWindowBackground(Canvas, ScrollingSupport.ClientRect); + Canvas.FillRect(ScrollingSupport.ClientRect); + Style.SetUIColor(Canvas, clWindowText); + + with ScrollingSupport.VertScrollBar do + begin + StartIndex := Position div ItemHeight; + EndIndex := (Position + PageSize) div ItemHeight; + end; + + Canvas.AppendTranslation(ScrollingSupport.ClientRect.TopLeft - + ScrollingSupport.ScrollPos); + + if StartIndex < 0 then + StartIndex := 0; + if EndIndex >= Items.Count then + EndIndex := Items.Count - 1; + + for i := StartIndex to EndIndex do + begin + Canvas.SaveState; + + ItemRect.Left := ScrollingSupport.HorzScrollBar.Position; + ItemRect.Top := i * ItemHeight; + ItemRect.Right := ScrollingSupport.ClientRect.Right - + ScrollingSupport.ClientRect.Left + + ScrollingSupport.HorzScrollBar.Position; + ItemRect.Bottom := (i + 1) * ItemHeight; + + Canvas.IntersectClipRect(ItemRect); + + ItemFlags := []; + if (wsHasFocus in WidgetState) and ((i = ItemIndex) or + ((ItemIndex = -1) and (i = 0))) then + Include(ItemFlags, ifFocused); + if i = ItemIndex then + Include(ItemFlags, ifSelected); + + Style.DrawItemBefore(Canvas, ItemRect, ItemFlags); +// Canvas.TextOut(Point(2, i * ItemHeight), Items[i]); + Style.DrawText(Canvas, Point(2, i * ItemHeight), Items[i], WidgetState); + Style.DrawItemAfter(Canvas, ItemRect, ItemFlags); + + Canvas.RestoreState; + end; +end; + +function TCustomListBox.ProcessEvent(Event: TEventObj): Boolean; +begin + if Event.InheritsFrom(TMousePressedEventObj) then + Result := ScrollingSupport.ProcessEvent(Event) or + EvMousePressed(TMousePressedEventObj(Event)) or + inherited ProcessEvent(Event) + else if Event.InheritsFrom(TMouseReleasedEventObj) then + Result := ScrollingSupport.ProcessEvent(Event) or + EvMouseReleased(TMouseReleasedEventObj(Event)) or + inherited ProcessEvent(Event) + else if Event.InheritsFrom(TMouseMoveEventObj) then + Result := ScrollingSupport.ProcessEvent(Event) or + EvMouseMoved(TMouseMoveEventObj(Event)) or + inherited ProcessEvent(Event) + else + Result := ScrollingSupport.ProcessEvent(Event) or + inherited ProcessEvent(Event); +end; + +function TCustomListBox.DistributeEvent(Event: TEventObj): Boolean; +begin + Result := ScrollingSupport.DistributeEvent(Event) or + inherited DistributeEvent(Event); +end; + +procedure TCustomListBox.CalcSizes; +begin + ScrollingSupport.CalcSizes; + ItemHeight := FindForm.Wnd.Canvas.FontCellHeight; + ScrollingSupport.VertScrollBar.SmallChange := ItemHeight; + RecalcWidth; +end; + +procedure TCustomListBox.Resized; +begin + ScrollingSupport.Resized; + UpdateScrollBars; +end; + +procedure TCustomListBox.RecalcWidth; +var + i, ItemWidth: Integer; +begin + if (not Assigned(FindForm)) or (not Assigned(FindForm.Wnd)) then + exit; + + FMaxItemWidth := 0; + for i := 0 to Items.Count - 1 do + begin + ItemWidth := FindForm.Wnd.Canvas.TextWidth(Items[i]) + 4; + if ItemWidth > FMaxItemWidth then + FMaxItemWidth := ItemWidth; + end; + UpdateScrollBars; +end; + +procedure TCustomListBox.UpdateScrollBars; +begin + ScrollingSupport.SetVirtualSize( + gfxBase.Size(FMaxItemWidth, Items.Count * ItemHeight - 1)); +end; + +procedure TCustomListBox.RedrawItem(AIndex: Integer); +var + ItemRect: TRect; +begin + if AIndex < 0 then + exit; + ItemRect := ScrollingSupport.ClientRect; + Inc(ItemRect.Top, AIndex * ItemHeight - + ScrollingSupport.VertScrollBar.Position); + if (ItemRect.Top > ScrollingSupport.ClientRect.Bottom) or + (ItemRect.Top + ItemHeight <= ScrollingSupport.ClientRect.Top) then + exit; + ItemRect.Bottom := Min(ItemRect.Top + ItemHeight, + ScrollingSupport.ClientRect.Bottom); + Redraw(ItemRect); +end; + + +// private methods + +function TCustomListBox.EvMousePressed(Event: TMousePressedEventObj): Boolean; +begin + if HotTrack then + Result := False + else if Event.Button = mbLeft then + Result := ProcessMouseEvent(Event) + else + Result := False; +end; + +function TCustomListBox.EvMouseReleased(Event: TMouseReleasedEventObj): Boolean; +begin + if HotTrack and (Event.Button = mbLeft) then + Result := ProcessMouseEvent(Event) + else + Result := False; +end; + +function TCustomListBox.EvMouseMoved(Event: TMouseMoveEventObj): Boolean; +begin + if HotTrack then + Result := ProcessMouseEvent(Event) + else + Result := False; +end; + +function TCustomListBox.ProcessMouseEvent(Event: TMouseEventObj): Boolean; +var + Index: Integer; +begin + if not PtInRect(ScrollingSupport.ClientRect, Event.Position) then + begin + Result := False; + exit; + end; + + Index := (Event.Position.y - ScrollingSupport.ClientRect.Top + + ScrollingSupport.VertScrollBar.Position) div ItemHeight; + if (Index >= 0) and (Index < Items.Count) and ((Index <> ItemIndex) or + (HotTrack and Event.InheritsFrom(TMouseReleasedEventObj))) then + begin + RedrawItem(ItemIndex); + FItemIndex := Index; + RedrawItem(ItemIndex); + if (not Event.InheritsFrom(TMouseMoveEventObj)) and Assigned(OnClick) then + OnClick(Self); + end; + +{ !!!: Re-include this for correct focus handling. But at the moment a focus + change results in a complete widget redraw, which is not very brilliant. } +// inherited ProcessEvent(Event); + + Result := True; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/menus.inc b/gui/menus.inc new file mode 100644 index 00000000..efaf5e28 --- /dev/null +++ b/gui/menus.inc @@ -0,0 +1,155 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Menu class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{ + All menu and menu item implementations +} + +{$IFDEF read_interface} + + { TMenuItem } + + TMenuItem = class(TCustomPanel) + private + FHotKeyDef: string; + FSeparator: boolean; + protected + function ProcessEvent(pEvent: TEventObj): Boolean; override; + public + constructor Create(const pText: string; pOwner: TComponent); overload; + published + property Separator: boolean read FSeparator write FSeparator; + property HotKeyDef: string read FHotKeyDef write FHotKeyDef; + property Text; + property Visible; + property Enabled; + end; + + + { TMenuBar } + + TMenuBar = class(TBinWidget) + private + protected + procedure Paint(Canvas: TFCanvas); override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function AddMenu(const pTitle: string): TMenuItem; + function AddMenu(const pTitle: string; const pHotKeyDef: string; pHandlerProc: TNotifyEvent): TMenuItem; + published +// FLayout: TBoxLayout; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +{ TMenuItem } + +function TMenuItem.ProcessEvent(pEvent: TEventObj): Boolean; +begin + if pEvent.InheritsFrom(TMouseMoveEventObj) then + Writeln('MenuItem ' + Text + + ' X=' + IntToStr(TMouseMoveEventObj(pEvent).Position.X) + + ',Y=' + IntToStr(TMouseMoveEventObj(pEvent).Position.Y)); + + Result := inherited ProcessEvent(pEvent); +end; + +constructor TMenuItem.Create(const pText: string; pOwner: TComponent); +begin + inherited Create(pText, pOwner); + FBevelStyle := bsPlain; +end; + + +procedure TMenuBar.Paint(Canvas: TFCanvas); +{var + i: integer; } +begin +// inherited Paint(Canvas); + Style.DrawWindowBackground(Canvas, ClientRect); +// FLayout.Paint(Canvas); +{ + + for i := 1 to VisibleCount do + begin + DrawColumn(Canvas, i, i = FFocusItem); + end; + + Style.DrawSeparator( + Canvas, + Rect(0, ClientRect.Bottom - 4, ClientRect.Right, ClientRect.Bottom), + Horizontal); + } +end; + +constructor TMenuBar.Create(AOwner: TComponent); +begin + inherited Create(AOwner); +// WidgetStyle := WidgetStyle + [wsCaptureMouse, wsClickable, wsOpaque]; + FCanExpandWidth := True; +{ + FLayout := TBoxLayout.Create(nil); + FLayout.Spacing := 0; + FLayout.BorderSpacing := 6; + FLayout.HorzAlign := horzLeft; + + InsertChild(FLayout); +} +end; + +destructor TMenuBar.Destroy; +begin +// RemoveChild(FLayout); +// FLayout.Free; + inherited Destroy; +end; + + +function TMenuBar.AddMenu(const pTitle: string): TMenuItem; +begin + Result := TMenuItem.Create(pTitle, self); +// FLayout.InsertChild(Result); +end; + + +function TMenuBar.AddMenu(const pTitle: string; const pHotKeyDef: string; + pHandlerProc: TNotifyEvent): TMenuItem; +begin + Result := TMenuItem.Create(self); + if pTitle <> '-' then + begin + Result.Text := pTitle; + Result.HotKeyDef := pHotKeyDef; + Result.OnClick := pHandlerProc; + end + else + begin + Result.Separator := True; + end; +// FLayout.InsertChild(Result); +end; + + +{$ENDIF read_implementation} + diff --git a/gui/panel.inc b/gui/panel.inc new file mode 100644 index 00000000..4fd3b2d5 --- /dev/null +++ b/gui/panel.inc @@ -0,0 +1,126 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Panel class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{ + Panel implementation. I mixture of Delphi's TPanel and TBevel. The class + name might change to Frame. +} + +{$IFDEF read_interface} + + TCustomPanel = class(TBinWidget) + private + FBevelStyle: TBevelStyle; + procedure SetBevelStyle(const AValue: TBevelStyle); + protected + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + procedure Resized; override; + property BevelStyle: TBevelStyle read FBevelStyle write SetBevelStyle; + {$Note Still outstanding is the Shape and Color properties for starters } + public + constructor Create(const pText: string; pOwner: TComponent); overload; + end; + + + TPanel = class(TCustomPanel) + published + property CanExpandWidth; + property CanExpandHeight; + property Enabled; + property Text; + property BevelStyle; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +procedure TCustomPanel.SetBevelStyle(const AValue: TBevelStyle); +begin + if FBevelStyle = AValue then exit; + FBevelStyle := AValue; + Redraw; +end; + +procedure TCustomPanel.Paint(Canvas: TFCanvas); +var + Pt: TPoint; +begin + Style.DrawPanel(Canvas, Rect(0, 0, Width, Height), FBevelStyle); + + if Text <> '' then + begin + Canvas.SetColor(Style.GetUIColor(clBtnText)); + Pt.x := (BoundsSize.cx - Canvas.TextWidth(Text)) div 2; + Pt.y := (BoundsSize.cy - Canvas.FontCellHeight) div 2; + Style.DrawText(Canvas, Pt, Text, WidgetState); + end; +end; + +procedure TCustomPanel.CalcSizes; +var + Borders: TRect; + LabelWidth: Integer; +begin + Borders := Style.GetGroupBoxBorders(TFCanvas(FindForm.Wnd.Canvas), Text, LabelWidth); + FMinSize.cx := Borders.Left + Borders.Right + LabelWidth; + FMinSize.cy := Borders.Top + Borders.Bottom; + if Assigned(Child) then + begin + if Child.MinSize.cx > LabelWidth then + FMinSize.cx := Borders.Left + Borders.Right + Child.MinSize.cx; + Inc(FMinSize.cy, Child.MinSize.cy); + if Child.DefSize.cx > LabelWidth then + FDefSize.cx := Borders.Left + Borders.Right + Child.MinSize.cx; + Inc(FDefSize.cy, Child.DefSize.cy); + if Child.MaxSize.cx > LabelWidth then + FMaxSize.cx := Min(Borders.Left + Borders.Right + Child.MaxSize.cx, InfiniteSize); + FMaxSize.cy := Min(MaxSize.cy + Child.MaxSize.cy, InfiniteSize); + end; +end; + +procedure TCustomPanel.Resized; +var + LabelWidth: Integer; + Borders: TRect; +begin + LabelWidth := 0; + if Assigned(Child) then + begin + Borders := Style.GetGroupBoxBorders(TFCanvas(FindForm.Wnd.Canvas), Text, LabelWidth); + Child.SetBounds(Borders.TopLeft, Size(Width - Borders.Left - Borders.Right, + Height - Borders.Top - Borders.Bottom)); + end; +end; + +constructor TCustomPanel.Create(const pText: string; pOwner: TComponent); +begin + Create(pOwner); + FCanExpandWidth := True; + FCanExpandHeight := True; + Text := pText; + FBevelStyle := bsRaised; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/popupwindow.inc b/gui/popupwindow.inc new file mode 100644 index 00000000..509d6962 --- /dev/null +++ b/gui/popupwindow.inc @@ -0,0 +1,60 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + PopupWindow class declaration + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + TPopupWindow = class(TCustomForm) + public + constructor Create(AOwner: TComponent); override; + procedure Show; override; + procedure Close; override; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +constructor TPopupWindow.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FParent := nil; + FWindowOptions := [woBorderless, woPopup]; +end; + + +procedure TPopupWindow.Show; +begin + inherited Show; + LAYOUTTRACE('TPopupWindow.Show for %s:%s', [Name, ClassName]); + Wnd.CaptureMouse; +end; + + +procedure TPopupWindow.Close; +begin + Wnd.ReleaseMouse; + inherited Close; +end; + +{$ENDIF read_implementation} + diff --git a/gui/progressbar.inc b/gui/progressbar.inc new file mode 100644 index 00000000..15183c15 --- /dev/null +++ b/gui/progressbar.inc @@ -0,0 +1,160 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Progress Bar class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{ + Progress Bar implementation +} + +{$IFDEF read_interface} + + { TCustomProgressBar } + + TCustomProgressBar = class(TCustomPanel) + private + FFillColor: TColor; + FMax: integer; + FMin: integer; + FPosition: integer; + FShowPercentage: Boolean; + procedure SetFillColor(const AValue: TColor); + procedure SetMax(const AValue: integer); + procedure SetMin(const AValue: integer); + procedure SetPosition(const AValue: integer); + procedure SetShowPercentage(const AValue: Boolean); + protected + procedure Paint(Canvas: TFCanvas); override; + property FillColor: TColor read FFillColor write SetFillColor default clRed; + property Position: integer read FPosition write SetPosition; + property Min: integer read FMin write SetMin default 0; + property Max: integer read FMax write SetMax default 100; + property ShowPercentage: Boolean read FShowPercentage write SetShowPercentage default True; + public + constructor Create(const pText: string; pOwner: TComponent); overload; + end; + + + TProgressBar = class(TCustomProgressBar) + published + property CanExpandWidth; + property CanExpandHeight; + property Enabled; +// property Text; + property FillColor; + property Position; + property Min; + property Max; + property ShowPercentage; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +procedure TCustomProgressBar.SetFillColor(const AValue: TColor); +begin + if FFillColor = AValue then exit; + FFillColor := AValue; + Redraw; +end; + +procedure TCustomProgressBar.SetMax(const AValue: integer); +begin + if FMax = AValue then exit; + FMax := AValue; + if FPosition > FMax then + FPosition := FMax; + Redraw; +end; + +procedure TCustomProgressBar.SetMin(const AValue: integer); +begin + if FMin = AValue then exit; + FMin := AValue; + if FPosition < FMin then + FPosition := FMin; + Redraw; +end; + +procedure TCustomProgressBar.SetPosition(const AValue: integer); +begin + if FPosition = AValue then + exit; //==> + if (AValue >= Min) and (AValue <= Max) then + begin + FPosition := AValue; + Redraw; + end; +end; + +procedure TCustomProgressBar.SetShowPercentage(const AValue: Boolean); +begin + if FShowPercentage = AValue then + Exit; //==> + FShowPercentage := AValue; + Redraw; +end; + +procedure TCustomProgressBar.Paint(Canvas: TFCanvas); +var + Pt: TPoint; + r: TRect; + p: integer; + percent: integer; + t: string; +begin + FText := ''; + inherited Paint(Canvas); + Canvas.SetColor(Style.GetUIColor(FFillColor)); + + percent := (100 div (Max - Min)) * FPosition; + p := (percent * (Width - 3)) div 100; + + r := Rect( + ClientRect.Left + 3, + ClientRect.Top + 3, + p, + ClientRect.Bottom - 3); + Canvas.FillRect(r); + + if FShowPercentage then + begin + t := IntToStr(percent) + '%'; + Pt.x := (Width - Canvas.TextWidth(t)) div 2; + Pt.y := (Height - Canvas.FontCellHeight) div 2; + Canvas.SetColor(Style.GetUIColor(clBtnText)); + Style.DrawText(Canvas, Pt, t, WidgetState); + end; +end; + +constructor TCustomProgressBar.Create(const pText: string; pOwner: TComponent); +begin + inherited Create(pText, pOwner); + FCanExpandHeight := False; + FBevelStyle := bsLowered; + FFillColor := clRed; + FMin := 0; + FMax := 100; + FShowPercentage := True; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/radiobutton.inc b/gui/radiobutton.inc new file mode 100644 index 00000000..6b31c538 --- /dev/null +++ b/gui/radiobutton.inc @@ -0,0 +1,142 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + RadioButton class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + { TCustomRadioButton } + + TCustomRadioButton = class(TWidget) + private + procedure SetChecked(AChecked: Boolean); + protected + FChecked: Boolean; + FLabelPos: TPoint; + procedure Click; override; + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + property Checked: Boolean read FChecked write SetChecked; + public + constructor Create(AOwner: TComponent); override; + constructor Create(const pText: string; pOwner: TComponent); overload; + end; + + + TRadioButton = class(TCustomRadioButton) + published + property CanExpandWidth; + property CanExpandHeight; + property Enabled; + property Checked; + property Text; + property OnClick; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + +// =================================================================== +// TCustomRadioButton +// =================================================================== + +constructor TCustomRadioButton.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WidgetStyle := WidgetStyle + [wsCaptureMouse, wsClickable]; +end; + + +constructor TCustomRadioButton.Create(const pText: string; pOwner: TComponent); +begin + Create(pOwner); + Text := pText; +end; + + +procedure TCustomRadioButton.Click; +begin + if not Checked then + SetChecked(True); + inherited Click; +end; + + +procedure TCustomRadioButton.Paint(Canvas: TFCanvas); +var + FontHeight: Integer; + LabelRect: TRect; + Flags: TCheckboxFlags; +begin + FontHeight := Canvas.FontCellHeight; + LabelRect.Left := FLabelPos.x; + LabelRect.Top := FLabelPos.y + (Height - MinSize.cy) div 2; + LabelRect.Right := LabelRect.Left + Canvas.TextWidth(Text); + LabelRect.Bottom := LabelRect.Top + FontHeight; + + Flags := []; + if (wsClicked in WidgetState) and (wsMouseInside in WidgetState) then + Include(Flags, cbIsPressed); + if (wsHasFocus in WidgetState) and FindForm.IsActive then + Include(Flags, cbHasFocus); + if wsEnabled in WidgetState then + Include(Flags, cbIsEnabled); + if Checked then + Include(Flags, cbIsChecked); + + Style.DrawRadioButton(Canvas, Rect(0, 0, Width, Height), LabelRect, Flags); + Canvas.SetColor(Style.GetUIColor(clWindowText)); + Style.DrawText(Canvas, LabelRect.TopLeft, Text, WidgetState); +end; + +procedure TCustomRadioButton.CalcSizes; +begin + with FindForm.Wnd.Canvas do + Style.GetRadioButtonLayout(gfxbase.Size(TextWidth(Text), FontCellHeight), + FMinSize, FLabelPos); +end; + +procedure TCustomRadioButton.SetChecked(AChecked: Boolean); +var + i: Integer; + Child: TWidget; +begin + if AChecked <> Checked then + begin + FChecked := AChecked; + Redraw; + + if Checked and Assigned(Parent) and + Parent.InheritsFrom(TContainerWidget) then + for i := 0 to TContainerWidget(Parent).ChildCount - 1 do + begin + Child := TContainerWidget(Parent).Children[i]; + if (Child <> Self) and Child.InheritsFrom(TCustomRadioButton) then + TCustomRadioButton(Child).Checked := False; + end; + end; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/scrollbar.inc b/gui/scrollbar.inc new file mode 100644 index 00000000..8a24584b --- /dev/null +++ b/gui/scrollbar.inc @@ -0,0 +1,730 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Scrollbar class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + // !!!: Add argument which indicates the type of scrolling + TScrollEvent = procedure(Sender: TObject; var APosition: Integer) of object; + + + TCustomScrollBar = class(TWidget) + private + FOrientation: TOrientation; + FMin: Integer; + FMax: Integer; + FPageSize: Integer; + FPosition: Integer; + FSmallChange: Integer; + FLargeChange: Integer; + FOnChange: TNotifyEvent; + FOnScroll: TScrollEvent; + ButtonUp: TGenericButton; + ButtonDown: TGenericButton; + Slider: TWidget; + Embedded: Boolean; // for internal embedded usage! + + // Event handling + procedure ButtonUpClick(Sender: TObject); + procedure ButtonDownClick(Sender: TObject); + // Property access + procedure SetOrientation(AOrientation: TOrientation); + procedure SetMin(AMin: Integer); + procedure SetMax(AMax: Integer); + procedure SetPageSize(APageSize: Integer); + procedure SetPosition(APosition: Integer); + // Helpers + function GetButtonSize: Integer; + function ClipPosition(APosition: Integer): Integer; + procedure UpdateBar; + protected + function DistributeEvent(Event: TEventObj): Boolean; override; + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + procedure Resized; override; + property Orientation: TOrientation read FOrientation write SetOrientation; + property Min: Integer read FMin write SetMin default 0; + property Max: Integer read FMax write SetMax default 100; + property PageSize: Integer read FPageSize write SetPageSize; + property Position: Integer read FPosition write SetPosition default 0; + property SmallChange: Integer read FSmallChange write FSmallChange default 1; + property LargeChange: Integer read FLargeChange write FLargeChange default 0; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + property OnScroll: TScrollEvent read FOnScroll write FOnScroll; + public + constructor Create(AOwner: TComponent); override; + procedure LineUp; + procedure LineDown; + procedure PageUp; + procedure PageDown; + end; + + + TScrollBar = class(TCustomScrollBar) + published + property Enabled; + property Orientation; + property Min; + property Max; + property PageSize; + property Position; + property SmallChange; + property LargeChange; + property OnChange; + property OnScroll; + end; + + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + + +// =================================================================== +// TCustomScrollBar and helper classes +// =================================================================== + +// ------------------------------------------------------------------- +// TScrollBarButton +// ------------------------------------------------------------------- + +type + { Private button type only used for scrollbars. } + TScrollBarButton = class(TGenericButton) + protected + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + public + Direction: TArrowDirection; + end; + + +procedure TScrollBarButton.Paint(Canvas: TFCanvas); +begin + inherited Paint(Canvas); + Style.DrawScrollBarButton(Canvas, Rect(0, 0, BoundsSize.cx, BoundsSize.cy), + Direction, (wsClicked in WidgetState) and (wsMouseInside in WidgetState), + wsEnabled in WidgetState); +end; + + +procedure TScrollBarButton.CalcSizes; +begin + ASSERT(Owner is TCustomScrollBar); + FMinSize := Style.GetScrollBarBtnSize(TCustomScrollBar(Owner).Orientation); +end; + + +// ------------------------------------------------------------------- +// TScrollBarSlider +// ------------------------------------------------------------------- + +type + TScrollBarSlider = class(TWidget) + private + function EvMousePressed(Event: TMousePressedEventObj): Boolean; + function EvMouseReleased(Event: TMouseReleasedEventObj): Boolean; + function EvMouseMove(Event: TMouseMoveEventObj): Boolean; + protected + ButtonPos: Integer; + ButtonSize: Integer; + IsDraggingButton: Boolean; + PrevAreaPressed: Boolean; + NextAreaPressed: Boolean; + DragStartMousePos: Integer; + DragStartButtonPos: Integer; +// ButtonMoveSavedPosition: Integer; + procedure Paint(Canvas: TFCanvas); override; + function ProcessEvent(Event: TEventObj): Boolean; override; + procedure CalcSizes; override; + function CalcPosition: Integer; + public + constructor Create(AOwner: TComponent); override; + procedure UpdateBar; + end; + + +constructor TScrollBarSlider.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WidgetStyle := WidgetStyle + [wsCaptureMouse, wsClickable, wsOpaque]; +end; + + +procedure TScrollBarSlider.UpdateBar; +var + Size: Integer; +begin + ASSERT(Owner is TCustomScrollBar); + + if Visible then + begin + with TCustomScrollBar(Owner) do + begin + if (Min = Max) or (Max - Min = PageSize - 1) then + ButtonPos := 0 + else + begin + if Orientation = Horizontal then + Size := Self.BoundsSize.cx + else + Size := Self.BoundsSize.cy; + + if PageSize = 0 then + ButtonPos := (Position - Min) * (Size - ButtonSize) div (Max - Min) + else + ButtonPos := (Position - Min) * + (Size - ButtonSize) div (Max - Min - PageSize + 1); + end; + ButtonSize := GetButtonSize; + end; + Redraw; + end; +end; + + +procedure TScrollBarSlider.Paint(Canvas: TFCanvas); +var + Size: Integer; + r: TRect; + StartPos, EndPos: PInteger; + Color2: TColor; +begin + ASSERT(Owner is TCustomScrollBar); + inherited Paint(Canvas); + + if TCustomScrollBar(Owner).Orientation = Horizontal then + begin + r.Top := 0; + r.Bottom := Height; + StartPos := @r.Left; + EndPos := @r.Right; + Size := Width; + end else + begin + r.Left := 0; + r.Right := Width; + StartPos := @r.Top; + EndPos := @r.Bottom; + Size := Height; + end; + + if ButtonPos > 0 then + begin + if PrevAreaPressed then + Color2 := cl3DDkShadow + else + Color2 := cl3DLight; + Canvas.SetColor(GetAvgColor(Style.GetUIColor(clScrollBar), + Style.GetUIColor(Color2))); + StartPos^ := 0; + EndPos^ := ButtonPos; + Canvas.FillRect(r); + end; + if ButtonPos + ButtonSize < Size then + begin + if NextAreaPressed then + Color2 := cl3DDkShadow + else + Color2 := cl3DLight; + Canvas.SetColor(GetAvgColor(Style.GetUIColor(clScrollBar), + Style.GetUIColor(Color2))); + StartPos^ := ButtonPos + ButtonSize; + EndPos^ := Size; + Canvas.FillRect(r); + end; + + StartPos^ := ButtonPos; + EndPos^ := ButtonPos + ButtonSize; + Style.DrawButtonFace(Canvas, r, [btnIsEmbedded]); +end; + + +function TScrollBarSlider.ProcessEvent(Event: TEventObj): Boolean; +begin + Result := False; + if Event.InheritsFrom(TMousePressedEventObj) then + Result := EvMousePressed(TMousePressedEventObj(Event)) + else if Event.InheritsFrom(TMouseReleasedEventObj) then + Result := EvMouseReleased(TMouseReleasedEventObj(Event)) + else if Event.InheritsFrom(TMouseMoveEventObj) then + Result := EvMouseMove(TMouseMoveEventObj(Event)); + + if not Result then + Result := inherited ProcessEvent(Event); + + if Event.InheritsFrom(TVisibilityChangeEventObj) and Visible then + UpdateBar; +end; + + +function TScrollBarSlider.EvMousePressed(Event: TMousePressedEventObj): Boolean; +var + Pos: Integer; +begin + Result := inherited ProcessEvent(Event); // For mouse grabbing support + + if Event.Button <> mbLeft then + exit; + + if TCustomScrollBar(Owner).Orientation = Horizontal then + Pos := Event.Position.x + else + Pos := Event.Position.y; + + if Pos < ButtonPos then + begin + PrevAreaPressed := True; + TCustomScrollBar(Owner).PageUp + end + else if Pos > ButtonPos + ButtonSize then + begin + NextAreaPressed := True; + TCustomScrollBar(Owner).PageDown + end + else + begin + IsDraggingButton := True; + DragStartMousePos := Pos; + DragStartButtonPos := ButtonPos; + end; + + Result := True; +end; + + +function TScrollBarSlider.EvMouseReleased( + Event: TMouseReleasedEventObj): Boolean; +var + NewPosition: Integer; +begin + Result := inherited ProcessEvent(Event); // For mouse grabbing support + + if Event.Button <> mbLeft then + exit; + + if IsDraggingButton then + begin + IsDraggingButton := False; + NewPosition := CalcPosition; + if NewPosition <> TCustomScrollBar(Owner).Position then + begin + if Assigned(TCustomScrollBar(Owner).OnScroll) then + TCustomScrollBar(Owner).OnScroll(Owner, NewPosition); + TCustomScrollBar(Owner).FPosition := NewPosition; + end; + if (NewPosition <> DragStartMousePos) and + Assigned(TCustomScrollBar(Owner).OnChange) then + TCustomScrollBar(Owner).OnChange(Self); + UpdateBar; + end + else if PrevAreaPressed then + begin + PrevAreaPressed := False; + Redraw; + end + else if NextAreaPressed then + begin + NextAreaPressed := False; + Redraw; + end; + Result := True; +end; + + +function TScrollBarSlider.EvMouseMove(Event: TMouseMoveEventObj): Boolean; +var + Pos, Size, VirtualPos: Integer; +begin + if IsDraggingButton then + begin + if wsMouseInside in WidgetState then + if TCustomScrollBar(Owner).Orientation = Horizontal then + begin + Pos := Event.Position.x; + Size := Width; + end else + begin + Pos := Event.Position.y; + Size := Height; + end + else + begin + Pos := DragStartMousePos; + if TCustomScrollBar(Owner).Orientation = Horizontal then + Size := Width + else + Size := Height; + end; + + ButtonPos := ClipMinMax(DragStartButtonPos + Pos - DragStartMousePos, + 0, Size - ButtonSize); + VirtualPos := CalcPosition; + + if VirtualPos <> TCustomScrollBar(Owner).Position then + begin + if Assigned(TCustomScrollBar(Owner).OnScroll) then + TCustomScrollBar(Owner).OnScroll(Owner, VirtualPos); + TCustomScrollBar(Owner).FPosition := VirtualPos; + end; + + Redraw; + Result := True + end else + Result := False; +end; + + +procedure TScrollBarSlider.CalcSizes; +begin + if TCustomScrollBar(Owner).Orientation = Horizontal then + FDefSize.cx := Style.GetScrollBarBtnSize(Horizontal).cy * 5 + else + FDefSize.cy := Style.GetScrollBarBtnSize(Vertical).cx * 5; +end; + + +function TScrollBarSlider.CalcPosition: Integer; +var + Size: Integer; +begin + with TCustomScrollBar(Owner) do + begin + if Orientation = Horizontal then + Size := Self.Width + else + Size := Self.Height; + + if Size = ButtonSize then + Position := 0 + else + begin + if PageSize = 0 then + Result := ButtonPos * (Max - Min + 1) + else + Result := ButtonPos * (Max - Min - PageSize + 2); + Result := Result div (Size - ButtonSize); + Result := Result + Min; + end; + Result := ClipPosition(Result); + end; +end; + + +// ------------------------------------------------------------------- +// TCustomScrollBar +// ------------------------------------------------------------------- + +constructor TCustomScrollBar.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Include(WidgetStyle, wsOpaque); + Embedded := False; + + FMax := 100; + FSmallChange := 1; + + ButtonUp := TScrollBarButton.Create(Self); + ButtonUp.Name := '#ScrollBarButtonUp'; + TScrollBarButton(ButtonUp).Direction := arrowLeft; + ButtonUp.Embedded := True; + ButtonUp.CanExpandWidth := False; + ButtonUp.CanExpandHeight := False; + ButtonUp.OnClick := @ButtonUpClick; + ButtonUp.SetEmbeddedParent(Self); + + Slider := TScrollBarSlider.Create(Self); + Slider.Name := '#ScrollBarSlider'; + Slider.SetEmbeddedParent(Self); + + ButtonDown := TScrollBarButton.Create(Self); + ButtonDown.Name := '#ScrollBarButtonDown'; + TScrollBarButton(ButtonDown).Direction := arrowRight; + ButtonDown.Embedded := True; + ButtonDown.CanExpandWidth := False; + ButtonDown.CanExpandHeight := False; + ButtonDown.OnClick := @ButtonDownClick; + ButtonDown.SetEmbeddedParent(Self); +end; + + +procedure TCustomScrollBar.LineUp; +begin + Position := Position - SmallChange; +end; + + +procedure TCustomScrollBar.LineDown; +begin + Position := Position + SmallChange; +end; + + +procedure TCustomScrollBar.PageUp; +var + Diff: Integer; +begin + if LargeChange = 0 then + begin + Diff := (Max - Min + 6) div 10; + if Diff = 0 then + Inc(Diff); + Position := Position - Diff; + end else + Position := Position - LargeChange; +end; + + +procedure TCustomScrollBar.PageDown; +var + Diff: Integer; +begin + if LargeChange = 0 then + begin + Diff := (Max - Min + 6) div 10; + if Diff = 0 then + Inc(Diff); + Position := Position + Diff; + end else + Position := Position + LargeChange; +end; + + +function TCustomScrollBar.DistributeEvent(Event: TEventObj): Boolean; +begin + Result := Event.SendToChild(Slider) or Event.SendToChild(ButtonUp) or + Event.SendToChild(ButtonDown); +end; + + +procedure TCustomScrollBar.Paint(Canvas: TFCanvas); +begin + if not Embedded then + Style.DrawScrollBarBorder(Canvas, Rect(0, 0, Width, Height)); +end; + + +procedure TCustomScrollBar.CalcSizes; +begin + if Orientation = Horizontal then + begin + FMinSize.cx := ButtonUp.DefSize.cx + Slider.MinSize.cx + ButtonDown.DefSize.cx; + FMinSize.cy := ButtonUp.DefSize.cy; + FDefSize.cx := ButtonUp.DefSize.cx + Slider.DefSize.cx + ButtonDown.DefSize.cx; + FDefSize.cy := ButtonUp.DefSize.cy; + FMaxSize.cx := InfiniteSize; + FMaxSize.cy := ButtonUp.DefSize.cy; + end else + begin + FMinSize.cx := ButtonUp.DefSize.cx; + FMinSize.cy := ButtonUp.DefSize.cy + Slider.MinSize.cy + ButtonDown.DefSize.cy; + FDefSize.cx := ButtonUp.DefSize.cx; + FDefSize.cy := ButtonUp.DefSize.cy + Slider.DefSize.cy + ButtonDown.DefSize.cy; + FMaxSize.cx := ButtonUp.DefSize.cx; + FMaxSize.cy := InfiniteSize; + end; + + if not Embedded then + with Style.GetScrollBarBorders(Orientation) do + begin + Inc(FMinSize.cx, Left + Right); + Inc(FMinSize.cy, Top + Bottom); + FDefSize.cx := fpGUI.Min(DefSize.cx + Left + Right, InfiniteSize); + FDefSize.cy := fpGUI.Min(DefSize.cy + Top + Bottom, InfiniteSize); + FMaxSize.cx := fpGUI.Min(MaxSize.cx + Left + Right, InfiniteSize); + FMaxSize.cy := fpGUI.Min(MaxSize.cy + Top + Bottom, InfiniteSize); + end; +end; + + +procedure TCustomScrollBar.Resized; +var + r: TRect; +begin + if not Embedded then + with Style.GetScrollBarBorders(Orientation) do + begin + r.Left := Left; + r.Top := Top; + r.Right := Width - Right; + r.Bottom := Height - Bottom; + end + else + begin + r.Left := 0; + r.Top := 0; + r.Right := Width; + r.Bottom := Height; + end; + + with r do + if Orientation = Horizontal then + begin + ButtonUp.SetBounds(TopLeft, Size(ButtonUp.DefSize.cx, Bottom - Top)); + ButtonDown.SetBounds(Point(Right - ButtonDown.DefSize.cx, Top), + Size(ButtonDown.DefSize.cx, Bottom - Top)); + Slider.SetBounds(Point(Left + ButtonUp.DefSize.cx, Top), + Size(Right - Left - ButtonUp.DefSize.cx - ButtonDown.DefSize.cx, + Bottom - Top)); + end + else + begin + ButtonUp.SetBounds(TopLeft, Size(Right - Left, ButtonDown.DefSize.cy)); + ButtonDown.SetBounds(Point(Left, Bottom - ButtonDown.DefSize.cy), + Size(Right - Left, ButtonDown.DefSize.cy)); + Slider.SetBounds(Point(Left, Top + ButtonUp.DefSize.cy), + Size(Right - Left, + Bottom - Top - ButtonUp.DefSize.cy - ButtonDown.DefSize.cy)); + end; + + UpdateBar; +end; + + +procedure TCustomScrollBar.ButtonUpClick(Sender: TObject); +begin + LineUp; +end; + + +procedure TCustomScrollBar.ButtonDownClick(Sender: TObject); +begin + LineDown; +end; + + +procedure TCustomScrollBar.SetOrientation(AOrientation: TOrientation); +begin + if AOrientation <> Orientation then + begin + FOrientation := AOrientation; + if Orientation = Horizontal then + begin + TScrollBarButton(ButtonUp).Direction := arrowLeft; + TScrollBarButton(ButtonDown).Direction := arrowRight; + end else + begin + TScrollBarButton(ButtonUp).Direction := arrowUp; + TScrollBarButton(ButtonDown).Direction := arrowDown; + end; + end; +end; + + +procedure TCustomScrollBar.SetMin(AMin: Integer); +begin + if AMin <> FMin then + begin + FMin := AMin; + Position := Position; // Do range clipping + UpdateBar; + end; +end; + + +procedure TCustomScrollBar.SetMax(AMax: Integer); +begin + if AMax <> FMax then + begin + FMax := AMax; + Position := Position; // Do range clipping + UpdateBar; + end; +end; + + +procedure TCustomScrollBar.SetPageSize(APageSize: Integer); +begin + if FPageSize <> APageSize then + begin + FPageSize := APageSize; + Position := Position; // Do range clipping + UpdateBar; + end; +end; + + +procedure TCustomScrollBar.SetPosition(APosition: Integer); +begin + APosition := ClipPosition(APosition); + + if (APosition <> Position) and Assigned(OnScroll) then + OnScroll(Self, APosition); + + if APosition <> Position then + begin + FPosition := APosition; + UpdateBar; + if Assigned(OnChange) then + OnChange(Self); + end; +end; + + +function TCustomScrollBar.GetButtonSize: Integer; +var + Size: Integer; +begin + if PageSize = 0 then + if Orientation = Horizontal then + Result := Height + else + Result := Width + else + begin + if Orientation = Horizontal then + Size := Slider.Width + else + Size := Slider.Height; + Result := fpGUI.Max(Style.GetScrollBarBtnMinSize, + PageSize * Size div fpGUI.Max(1, Max - Min + 1)); + if Result > Size then + Result := Size; + end; +end; + + +function TCustomScrollBar.ClipPosition(APosition: Integer): Integer; +begin + if APosition > Max - PageSize then + if PageSize = 0 then + Result := Max + else + Result := Max - PageSize + 1 + else + Result := APosition; + if Result < Min then + Result := Min; +end; + + +procedure TCustomScrollBar.UpdateBar; +begin + if Embedded then + Visible := (Max > Min) and ((PageSize = 0) or (PageSize <= Max - Min)); + TScrollBarSlider(Slider).UpdateBar; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/scrollbox.inc b/gui/scrollbox.inc new file mode 100644 index 00000000..123060db --- /dev/null +++ b/gui/scrollbox.inc @@ -0,0 +1,429 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Scrollbox class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{ Scrolling support implementation } + +{$IFDEF read_interface} + + TScrollingSupport = class + private + Parent: TWidget; + FBorders: TRect; + FClientRect: TRect; + FVirtualSize: TSize; + FHorzScrollBar, FVertScrollBar: TScrollBar; + FOnClientRectChange: TNotifyEvent; + function EvMouseWheel(Event: TMouseWheelEventObj): Boolean; + public + constructor Create(AParent: TWidget); + destructor Destroy; override; + function ProcessEvent(Event: TEventObj): Boolean; + function DistributeEvent(Event: TEventObj): Boolean; + function SendToChild(AChild: TWidget; Event: TEventObj): Boolean; + procedure CalcSizes; + procedure Resized; + function CalcClientSize(AHorzBarVisible, AVertBarVisible: Boolean): TSize; + procedure SetVirtualSize(const ASize: TSize); + function ScrollPos: TPoint; + procedure DefHorzScrollHandler(Sender: TObject; var APosition: Integer); + procedure DefVertScrollHandler(Sender: TObject; var APosition: Integer); + property Borders: TRect read FBorders; + property ClientRect: TRect read FClientRect; + property HorzScrollBar: TScrollBar read FHorzScrollBar; + property VertScrollBar: TScrollBar read FVertScrollBar; + property OnClientRectChange: TNotifyEvent read FOnClientRectChange write FOnClientRectChange; + end; + + + TCustomScrollBox = class(TWidget) + protected + ScrollingSupport: TScrollingSupport; + procedure Paint(Canvas: TFCanvas); override; + function ProcessEvent(Event: TEventObj): Boolean; override; + function DistributeEvent(Event: TEventObj): Boolean; override; +// procedure EvKeyPressed(Key: Word; Shift: TShiftState); override; + procedure CalcSizes; override; + procedure Resized; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + end; + + + TScrollBox = class(TCustomScrollBox) + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +// =================================================================== +// TScrollingSupport +// =================================================================== + +constructor TScrollingSupport.Create(AParent: TWidget); +begin + Parent := AParent; + + FHorzScrollBar := TScrollBar.Create(Parent); + HorzScrollBar.Name := '#Scrolling_HorzBar'; + HorzScrollBar.Embedded := True; + HorzScrollBar.SetEmbeddedParent(Parent); + + FVertScrollBar := TScrollBar.Create(Parent); + VertScrollBar.Name := '#Scrolling_VertBar'; + VertScrollBar.Orientation := Vertical; + VertScrollBar.Embedded := True; + VertScrollBar.SetEmbeddedParent(Parent); +end; + +destructor TScrollingSupport.Destroy; +begin + inherited Destroy; +end; + +function TScrollingSupport.ProcessEvent(Event: TEventObj): Boolean; +var + HorzScrollBarHeight, VertScrollBarWidth: Integer; + Canvas: TFCanvas; +begin + if Event.InheritsFrom(TPaintEventObj) then + begin + if HorzScrollBar.Visible then + HorzScrollBarHeight := HorzScrollBar.MinSize.cy + else + HorzScrollBarHeight := 0; + + if VertScrollBar.Visible then + VertScrollBarWidth := VertScrollBar.MinSize.cx + else + VertScrollBarWidth := 0; + + Canvas := TPaintEventObj(Event).Canvas; + Parent.Style.DrawScrollBoxBorder(Canvas, + Rect(0, 0, Parent.Width, Parent.Height)); + Parent.Style.DrawWindowBackground(Canvas, Rect(VertScrollBar.Left, + HorzScrollBar.Top, VertScrollBar.Left + VertScrollBarWidth, + HorzScrollBar.Top + HorzScrollBarHeight)); + Result := False; + end else if Event.InheritsFrom(TMouseWheelEventObj) then + Result := EvMouseWheel(TMouseWheelEventObj(Event)) + else + Result := False; +end; + +function TScrollingSupport.DistributeEvent(Event: TEventObj): Boolean; +begin + Result := Event.SendToChild(HorzScrollBar) or + Event.SendToChild(VertScrollBar); +end; + +function TScrollingSupport.SendToChild(AChild: TWidget; + Event: TEventObj): Boolean; +var + Canvas: TFCanvas; + OldMatrix: TGfxMatrix; +begin + if Event.InheritsFrom(TPreparePaintEventObj) then + begin + Canvas := TPaintEventObj(Event).Canvas; + OldMatrix := Canvas.Matrix; + Canvas.AppendTranslation(Point(ClientRect.Left - HorzScrollBar.Position, + ClientRect.Top - VertScrollBar.Position)); + Result := Event.SendToChild(AChild); + Canvas.Matrix := OldMatrix; + end else if Event.InheritsFrom(TPaintEventObj) then + begin + Canvas := TPaintEventObj(Event).Canvas; + Canvas.SaveState; + try + Canvas.AppendTranslation(Point(-HorzScrollBar.Position, + -VertScrollBar.Position)); + if Canvas.IntersectClipRect(ClientRect) {and Canvas.IntersectClipRect( + Rect(AChild.Left + ClientRect.Left, AChild.Top + ClientRect.Top, + AChild.Left + AChild.Width + ClientRect.Left, + AChild.Top + AChild.Height + ClientRect.Top))} then + begin + {Canvas.AppendTranslation(AChild.Left + ClientRect.Left, + AChild.Top + ClientRect.Top); + Inc(Event.RefCount); + Result := AChild.SendEvent(Event);} + Canvas.AppendTranslation(ClientRect.TopLeft); + Result := Event.SendToChild(AChild); + end else + Result := False; + finally + Canvas.RestoreState; + end; + end else + Result := Event.SendToChild(AChild); +end; + +procedure TScrollingSupport.CalcSizes; +begin + FBorders := Parent.Style.GetScrollBoxBorders; + with Parent, Borders do + begin + FMinSize := HorzScrollBar.MinSize + VertScrollBar.MinSize + + TopLeft + BottomRight; + FDefSize := HorzScrollBar.DefSize + VertScrollBar.DefSize + + TopLeft + BottomRight; + end; +end; + +procedure TScrollingSupport.Resized; +var + HorzScrollBarHeight, VertScrollBarWidth: Integer; + + procedure CalcScrollBarSizes; + begin + if HorzScrollBar.Visible then + HorzScrollBarHeight := HorzScrollBar.MinSize.cy + else + HorzScrollBarHeight := 0; + + if VertScrollBar.Visible then + VertScrollBarWidth := VertScrollBar.MinSize.cx + else + VertScrollBarWidth := 0; + end; + +var + Canvas: TFCanvas; + HorzBarVisible, VertBarVisible, + LastHorzBarVisible, LastVertBarVisible: Boolean; +begin + HorzBarVisible := HorzScrollBar.Visible; + VertBarVisible := VertScrollBar.Visible; + LastHorzBarVisible := not HorzBarVisible; + + if FVirtualSize <> gfxbase.Size(0, 0) then + with gfxbase.Size(ClientRect) do + begin + HorzScrollBar.PageSize := cx; + VertScrollBar.PageSize := cy; + end; + + FBorders := Parent.Style.GetScrollBoxBorders; + with FBorders do + begin + while (HorzBarVisible <> LastHorzBarVisible) or + (VertBarVisible <> LastVertBarVisible) do + begin + LastHorzBarVisible := HorzBarVisible; + LastVertBarVisible := VertBarVisible; + CalcScrollBarSizes; + HorzScrollBar.SetBounds( + Point(Left, Parent.Height - HorzScrollBar.MinSize.cy - Bottom), + gfxbase.Size(Parent.Width - VertScrollBarWidth - Left - Right, + HorzScrollBar.MinSize.cy)); + VertScrollBar.SetBounds( + Point(Parent.Width - VertScrollBar.MinSize.cx - Right, Top), + gfxbase.Size(VertScrollBar.MinSize.cx, + Parent.Height - HorzScrollBarHeight - Top - Bottom)); + + ClientRect.Left := Left; + ClientRect.Top := Top; + ClientRect.Right := Parent.Width - Right - VertScrollBarWidth; + ClientRect.Bottom := Parent.Height - Bottom - HorzScrollBarHeight; + if Assigned(OnClientRectChange) then + OnClientRectChange(Self); + + HorzBarVisible := HorzScrollBar.Visible; + VertBarVisible := VertScrollBar.Visible; + end; + end; +end; + +function TScrollingSupport.CalcClientSize(AHorzBarVisible, + AVertBarVisible: Boolean): TSize; +begin + FBorders := Parent.Style.GetScrollBoxBorders; + Result := Parent.BoundsSize - Borders.TopLeft - Borders.BottomRight; + if AVertBarVisible then + Dec(Result.cx, VertScrollBar.MinSize.cx); + if AHorzBarVisible then + Dec(Result.cy, HorzScrollBar.MinSize.cy); +end; + +procedure TScrollingSupport.SetVirtualSize(const ASize: TSize); +begin + FVirtualSize := ASize; + HorzScrollBar.Max := FVirtualSize.cx; + VertScrollBar.Max := FVirtualSize.cy; +end; + +function TScrollingSupport.ScrollPos: TPoint; +begin + Result.x := HorzScrollBar.Position; + Result.y := VertScrollBar.Position; +end; + +procedure TScrollingSupport.DefHorzScrollHandler(Sender: TObject; + var APosition: Integer); +var + Delta: Integer; + r: TRect; +begin + Delta := HorzScrollBar.Position - APosition; + r := ClientRect; + if Delta < 0 then // Scrolling to the right side + Dec(r.Left, Delta) + else // Scrolling to the left side + Dec(r.Right, Delta); + Parent.Scroll(r, Delta, 0); +end; + +procedure TScrollingSupport.DefVertScrollHandler(Sender: TObject; + var APosition: Integer); +var + Delta: Integer; + r: TRect; +begin + Delta := VertScrollBar.Position - APosition; + r := ClientRect; + if Delta < 0 then // Scrolling downwards + Dec(r.Top, Delta) + else // Scrolling upwards + Dec(r.Bottom, Delta); + Parent.Scroll(r, 0, Delta); +end; + +function TScrollingSupport.EvMouseWheel(Event: TMouseWheelEventObj): Boolean; +var + mshift: TShiftState; +begin + if Parent.DistributeEvent(Event) then + exit; + + mshift := Event.Shift * [ssShift, ssAlt, ssCtrl, ssMeta, + ssSuper, ssHyper, ssAltGr]; + + if not VertScrollBar.Visible then + Include(mshift, ssShift); + + if mshift = [] then + VertScrollBar.Position := VertScrollBar.Position + + Round(Event.WheelDelta * VertScrollBar.SmallChange) + else if mshift = [ssShift] then + HorzScrollBar.Position := HorzScrollBar.Position + + Round(Event.WheelDelta * VertScrollBar.SmallChange); + Result := True; +end; + + +// =================================================================== +// TCustomScrollBox +// =================================================================== + +constructor TCustomScrollBox.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WidgetStyle := WidgetStyle + [wsClickable, wsOpaque]; + FCanExpandWidth := True; + FCanExpandHeight := True; + ScrollingSupport := TScrollingSupport.Create(Self); +end; + +destructor TCustomScrollBox.Destroy; +begin + ScrollingSupport.Free; + inherited Destroy; +end; + + +// Protected methods + +procedure TCustomScrollBox.Paint(Canvas: TFCanvas); +begin +{ + Style.DrawWindowBackground(Canvas, Rect(HorzScrollBar.Left, + VertScrollBar.Top, HorzScrollBar.Left + HorzScrollBar.Width, + VertScrollBar.Top + VertScrollBar.Height));} +end; + +function TCustomScrollBox.ProcessEvent(Event: TEventObj): Boolean; +begin + Result := ScrollingSupport.ProcessEvent(Event) or + inherited ProcessEvent(Event); +end; + +function TCustomScrollBox.DistributeEvent(Event: TEventObj): Boolean; +begin + Result := ScrollingSupport.DistributeEvent(Event) or + inherited DistributeEvent(Event); +end; + +procedure TCustomScrollBox.CalcSizes; +begin + ScrollingSupport.CalcSizes; +end; + +procedure TCustomScrollBox.Resized; +begin + ScrollingSupport.Resized; +end; + +{ !!!: Move to TScrollingSupport as soon as this is a real event +procedure TCustomScrollBox.EvKeyPressed(Key: Word; Shift: TShiftState); +var + mshift: TShiftState; +begin + mshift := Shift * [ssShift, ssAlt, ssCtrl, ssMeta, ssSuper, ssHyper, ssAltGr]; + if mshift = [] then + case Key of + keyLeft: + HorzScrollBar.ButtonUpClick(nil); + keyRight: + HorzScrollBar.ButtonDownClick(nil); + keyUp: + VertScrollBar.ButtonUpClick(nil); + keyDown: + VertScrollBar.ButtonDownClick(nil); + keyPageUp: + VertScrollBar.PageUp; + keyPageDown: + VertScrollBar.PageDown; + keyHome: + VertScrollBar.Position := 0; + keyEnd: + VertScrollBar.Position := VertScrollBar.Max - VertScrollBar.PageSize; + end + else if mshift = [ssShift] then + case Key of + keyPageUp: + HorzScrollBar.PageUp; + keyPageDown: + HorzScrollBar.PageDown; + keyHome: + HorzScrollBar.Position := 0; + keyEnd: + HorzScrollBar.Position := HorzScrollBar.Max - HorzScrollBar.PageSize; + end + else + inherited EvKeyPressed(Key, Shift); +end;} + + +{$ENDIF read_implementation} + diff --git a/gui/separator.inc b/gui/separator.inc new file mode 100644 index 00000000..32cc4c5f --- /dev/null +++ b/gui/separator.inc @@ -0,0 +1,106 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Separator class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + + TCustomSeparator = class(TWidget) + private + procedure SetOrientation(AOrientation: TOrientation); + procedure SetSpacing(ASpacing: Integer); + protected + FOrientation: TOrientation; + FSpacing: Integer; + procedure Paint(Canvas: TFCanvas); override; + procedure CalcSizes; override; + property Orientation: TOrientation read FOrientation write SetOrientation default Horizontal; + property Spacing: Integer read FSpacing write SetSpacing default 4; + public + constructor Create(AOwner: TComponent); override; + end; + + + TSeparator = class(TCustomSeparator) + published + property Enabled; + property Orientation; + property Spacing; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + + +// =================================================================== +// TCustomSeparator +// =================================================================== + +constructor TCustomSeparator.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FCanExpandWidth := True; + FSpacing := 4; +end; + +procedure TCustomSeparator.Paint(Canvas: TFCanvas); +begin + Style.DrawSeparator(Canvas, Rect(0, 0, Width, Height), Orientation); +end; + +procedure TCustomSeparator.CalcSizes; +begin + if Orientation = Horizontal then + begin + FCanExpandWidth := True; + FCanExpandHeight := False; + FMinSize.cy := Style.GetSeparatorSize + 2 * Spacing + end else + begin + FCanExpandWidth := False; + FCanExpandHeight := True; + FMinSize.cx := Style.GetSeparatorSize + 2 * Spacing; + end; +end; + +procedure TCustomSeparator.SetOrientation(AOrientation: TOrientation); +begin + if AOrientation <> Orientation then + begin + FOrientation := AOrientation; + Update; + end; +end; + +procedure TCustomSeparator.SetSpacing(ASpacing: Integer); +begin + if ASpacing <> Spacing then + begin + FSpacing := ASpacing; + Update; + end; +end; + + +{$ENDIF read_implementation} + diff --git a/gui/style.inc b/gui/style.inc new file mode 100644 index 00000000..2e705213 --- /dev/null +++ b/gui/style.inc @@ -0,0 +1,850 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Style class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{ + Default style implementation +} + +{$IFDEF read_interface} + + { Possible styles } + TItemFlags = set of (ifFocused, ifSelected, ifDeactivated); + + { Possible arrow directions } + TArrowDirection = (arrowUp, arrowDown, arrowLeft, arrowRight); + + { Style declarations } + TStyle = class + protected + UIColorCache: array[0..$18] of TGfxColor; + public + constructor Create(ADisplay: TFCustomApplication); virtual; + // Colors + procedure UpdateUIColorCache; + function GetGUIColor(Color: TColor): TGfxColor; virtual; abstract; + function GetUIColor(AColor: TColor): TGfxColor; + procedure SetUIColor(Canvas: TFCanvas; Color: TColor); + // General + procedure DrawText(Canvas: TFCanvas; const APosition: TPoint; const AText: String; State: TWidgetState); virtual; abstract; + procedure DrawItemBefore(Canvas: TFCanvas; const ARect: TRect; Flags: TItemFlags); virtual; abstract; + procedure DrawItemAfter(Canvas: TFCanvas; const ARect: TRect; Flags: TItemFlags); virtual; abstract; + procedure Draw3DFrame(Canvas: TFCanvas; const ARect: TRect; Color1, Color2, Color3, Color4: TColor); virtual; abstract; + procedure DrawFocusRect(Canvas: TFCanvas; const ARect: TRect); virtual; abstract; + procedure DrawSunkenOuterBorder(Canvas: TFCanvas; const ARect: TRect); virtual; abstract; + procedure DrawRaisedOuterBorder(Canvas: TFCanvas; const ARect: TRect); virtual; abstract; + // Windows + procedure DrawWindowBackground(Canvas: TFCanvas; const ARect: TRect); virtual; abstract; + // Buttons + procedure DrawButtonFace(Canvas: TFCanvas; const ARect: TRect; Flags: TButtonFlags); virtual; abstract; + function GetButtonBorders: TRect; virtual; abstract; + // Separators + function GetSeparatorSize: Integer; virtual; abstract; + procedure DrawSeparator(Canvas: TFCanvas; const ARect: TRect; AOrientation: TOrientation); virtual; abstract; + // Group boxes + procedure DrawGroupBox(Canvas: TFCanvas; const ARect: TRect; const ALabel: String; WidgetState: TWidgetState); virtual; abstract; + function GetGroupBoxBorders(Canvas: TFCanvas; const ALabel: String; var LabelWidth: Integer): TRect; virtual; abstract; + // Edit widgets + procedure DrawEditBox(Canvas: TFCanvas; const ARect: TRect); virtual; abstract; + function GetEditBoxBorders: TRect; virtual; abstract; + // Check boxes + procedure DrawCheckBox(Canvas: TFCanvas; const ARect, LabelRect: TRect; Flags: TCheckboxFlags); virtual; abstract; + procedure GetCheckBoxLayout(const LabelSize: TSize; var TotalSize: TSize; var LabelPos: TPoint); virtual; abstract; + // Radio buttons + procedure DrawRadioButton(Canvas: TFCanvas; const ARect, LabelRect: TRect; Flags: TCheckboxFlags); virtual; abstract; + procedure GetRadioButtonLayout(const LabelSize: TSize; var TotalSize: TSize; var LabelPos: TPoint); virtual; abstract; + // Combo boxes + function GetComboBoxArrowSize: TSize; virtual; abstract; + procedure DrawComboBoxArrow(Canvas: TFCanvas; const ARect: TRect; IsPressed, IsEnabled: Boolean); virtual; abstract; + // Scroll bars + function GetScrollBarBorders(Orientation: TOrientation): TRect; virtual; abstract; + function GetScrollBarBtnSize(Orientation: TOrientation): TSize; virtual; abstract; + function GetScrollBarBtnMinSize: Integer; virtual; abstract; + procedure DrawScrollBarBorder(Canvas: TFCanvas; const ARect: TRect); virtual; abstract; + procedure DrawScrollBarButton(Canvas: TFCanvas; const ARect: TRect; Direction: TArrowDirection; IsPressed, IsEnabled: Boolean); virtual; abstract; + // Scroll boxes + function GetScrollBoxBorders: TRect; virtual; abstract; + procedure DrawScrollBoxBorder(Canvas: TFCanvas; const ARect: TRect); virtual; abstract; + // Menus + function GetMenuBorders(pCanvas: TFCanvas; const pText: string; var pTextWidth: Integer): TRect; virtual; abstract; + // Panel/Frame + function GetPanelBorders: TRect; virtual; abstract; + procedure DrawPanel(Canvas: TFCanvas; const ARect: TRect; ABevelStyle: TBevelStyle); virtual; abstract; + end; + + + { TDefaultStyle } + + TDefaultStyle = class(TStyle) + protected + ImageCanvas, MaskCanvas: TFCanvas; +// ArrowBitmaps: array[TArrowDirection] of TGfxImage; + public + constructor Create(ADisplay: TFCustomApplication); override; + destructor Destroy; override; + // Colors + function GetGUIColor(Color: TColor): TGfxColor; override; + // General + procedure DrawText(Canvas: TFCanvas; const APosition: TPoint; const AText: String; State: TWidgetState); override; + procedure DrawItemBefore(Canvas: TFCanvas; const ARect: TRect; Flags: TItemFlags); override; + procedure DrawItemAfter(Canvas: TFCanvas; const ARect: TRect; Flags: TItemFlags); override; + procedure Draw3DFrame(Canvas: TFCanvas; const ARect: TRect; Color1, Color2, Color3, Color4: TColor); override; + procedure DrawFocusRect(Canvas: TFCanvas; const ARect: TRect); override; + procedure DrawSunkenOuterBorder(Canvas: TFCanvas; const ARect: TRect); override; + procedure DrawRaisedOuterBorder(Canvas: TFCanvas; const ARect: TRect); override; + // Windows + procedure DrawWindowBackground(Canvas: TFCanvas; const ARect: TRect); override; + // Buttons + procedure DrawButtonFace(Canvas: TFCanvas; const ARect: TRect; Flags: TButtonFlags); override; + function GetButtonBorders: TRect; override; + // Separators + procedure DrawSeparator(Canvas: TFCanvas; const ARect: TRect; AOrientation: TOrientation); override; + function GetSeparatorSize: Integer; override; + // Group boxes + procedure DrawGroupBox(Canvas: TFCanvas; const ARect: TRect; const ALabel: String; WidgetState: TWidgetState); override; + function GetGroupBoxBorders(Canvas: TFCanvas; const ALabel: String; var LabelWidth: Integer): TRect; override; + // Edit widgets + procedure DrawEditBox(Canvas: TFCanvas; const ARect: TRect); override; + function GetEditBoxBorders: TRect; override; + // Check boxes + procedure DrawCheckBox(Canvas: TFCanvas; const ARect, LabelRect: TRect; Flags: TCheckboxFlags); override; + procedure GetCheckBoxLayout(const LabelSize: TSize; var TotalSize: TSize; var LabelPos: TPoint); override; + // Radio buttons + procedure DrawRadioButton(Canvas: TFCanvas; const ARect, LabelRect: TRect; Flags: TCheckboxFlags); override; + procedure GetRadioButtonLayout(const LabelSize: TSize; var TotalSize: TSize; var LabelPos: TPoint); override; + // Combo boxes + procedure DrawComboBoxArrow(Canvas: TFCanvas; const ARect: TRect; IsPressed, IsEnabled: Boolean); override; + function GetComboBoxArrowSize: TSize; override; + // Scroll bars + function GetScrollBarBorders(Orientation: TOrientation): TRect; override; + function GetScrollBarBtnSize(Orientation: TOrientation): TSize; override; + function GetScrollBarBtnMinSize: Integer; override; + procedure DrawScrollBarBorder(Canvas: TFCanvas; const ARect: TRect); override; + procedure DrawScrollBarButton(Canvas: TFCanvas; const ARect: TRect; Direction: TArrowDirection; IsPressed, IsEnabled: Boolean); override; + // Scroll boxes + function GetScrollBoxBorders: TRect; override; + procedure DrawScrollBoxBorder(Canvas: TFCanvas; const ARect: TRect); override; + // Menus + function GetMenuBorders(pCanvas: TFCanvas; const pText: string; var pTextWidth: Integer): TRect; override; + // Panel/Frame + function GetPanelBorders: TRect; override; + procedure DrawPanel(Canvas: TFCanvas; const ARect: TRect; ABevelStyle: TBevelStyle); override; + end; + + + { TMotifStyle } + + TMotifStyle = class(TDefaultStyle) + public + // General + procedure DrawFocusRect(Canvas: TFCanvas; const ARect: TRect); override; + // Buttons + procedure DrawButtonFace(Canvas: TFCanvas; const ARect: TRect; Flags: TButtonFlags); override; + // Check boxes + procedure DrawCheckBox(Canvas: TFCanvas; const ARect, LabelRect: TRect; Flags: TCheckboxFlags); override; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + + +{ TStyle } + +constructor TStyle.Create(ADisplay: TFCustomApplication); +begin + inherited Create; + UpdateUIColorCache; +end; + + +procedure TStyle.UpdateUIColorCache; +var + i: TColor; +begin + for i := 0 to $18 do + UIColorCache[i] := GetGUIColor(TColor(i + clScrollBar)); +end; + + +function TStyle.GetUIColor(AColor: TColor): TGfxColor; +begin + if (AColor >= clScrollBar) and (AColor <= clScrollBar + $18) then + Result := UIColorCache[TColor(AColor - clScrollBar)] + else + begin +// Result := colBlack; + Result.Red := (AColor and $ff) * 257; + Result.Green := ((AColor shr 8) and $ff) * 257; + Result.Blue := ((AColor shr 16) and $ff) * 257; + Result.Alpha := 0; + end; +end; + + +procedure TStyle.SetUIColor(Canvas: TFCanvas; Color: TColor); +var + lGfxColor: TGfxColor; +begin + if (Color >= clScrollBar) and (Color <= clScrollBar + $18) then + Canvas.SetColor(UIColorCache[TColor(Color - clScrollBar)]) + else + begin + lGfxColor.Red := (Color and $ff) * 257; + lGfxColor.Green := ((Color shr 8) and $ff) * 257; + lGfxColor.Blue := ((Color shr 16) and $ff) * 257; + lGfxColor.Alpha := 0; + Canvas.SetColor(lGfxColor); + end; +end; + + +{ TDefaultStyle } + +const + rgbaDkWhite: TGfxColor = (Red: $e000; Green: $e000; Blue: $e000; Alpha: 0); + + +{ This gets platform specific colors and focus rectangle styles } +{$IFDEF MSWINDOWS} + {$I win32/defstyle.inc} +{$ENDIF} +{$IFDEF UNIX} + {$I defimpl/defstyle.inc} +{$ENDIF} + + +constructor TDefaultStyle.Create(ADisplay: TFCustomApplication); +const + // 60x12 pixel 4bpp bitmap + RadioBitmapData: array[0..359] of Byte = ( + $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, + $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, + $02, $11, $77, $77, $11, $50, $02, $11, $77, $77, $11, $50, $02, $11, $33, $33, $11, $50, $02, $11, $33, $33, $11, $50, $02, $11, $33, $33, $11, $50, + $02, $17, $77, $77, $74, $50, $02, $17, $77, $77, $74, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, + $21, $77, $77, $77, $77, $45, $21, $77, $76, $67, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $36, $63, $33, $45, $21, $33, $32, $23, $33, $45, + $21, $77, $77, $77, $77, $45, $21, $77, $66, $66, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $66, $66, $33, $45, $21, $33, $22, $22, $33, $45, + $21, $77, $77, $77, $77, $45, $21, $77, $66, $66, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $66, $66, $33, $45, $21, $33, $22, $22, $33, $45, + $21, $77, $77, $77, $77, $45, $21, $77, $76, $67, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $36, $63, $33, $45, $21, $33, $32, $23, $33, $45, + $02, $17, $77, $77, $74, $50, $02, $17, $77, $77, $74, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, + $02, $44, $77, $77, $44, $50, $02, $44, $77, $77, $44, $50, $02, $44, $33, $33, $44, $50, $02, $44, $33, $33, $44, $50, $02, $44, $33, $33, $44, $50, + $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, + $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00 + ); + + // 12x12 pixel monochrome bitmap + RadioMaskData: array[0..23] of Byte = ($0f, $00, $3f, $c0, $7f, $e0, $7f, + $e0, $ff, $f0, $ff, $f0, $ff, $f0, $ff, $f0, $7f, $e0, $7f, $e0, $3f, $c0, + $0f, $00); + + // 65x13 pixel 4bpp bitmap + CheckBoxBitmapData: array[0..428] of Byte = ( + $22, $22, $22, $22, $22, $22, $52, $22, $22, $22, $22, $22, $25, $22, $22, $22, $22, $22, $22, $52, $22, $22, $22, $22, $22, $25, $22, $22, $22, $22, $22, $22, $50, + $21, $11, $11, $11, $11, $14, $52, $11, $11, $11, $11, $11, $45, $21, $11, $11, $11, $11, $14, $52, $11, $11, $11, $11, $11, $45, $21, $11, $11, $11, $11, $14, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $33, $33, $45, $21, $33, $33, $33, $33, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $77, $67, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $33, $63, $45, $21, $33, $33, $33, $32, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $76, $67, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $36, $63, $45, $21, $33, $33, $33, $22, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $67, $77, $66, $67, $45, $21, $33, $33, $33, $33, $34, $52, $13, $63, $33, $66, $63, $45, $21, $32, $33, $32, $22, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $66, $76, $66, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $66, $36, $66, $33, $45, $21, $32, $23, $22, $23, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $66, $66, $67, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $66, $66, $63, $33, $45, $21, $32, $22, $22, $33, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $76, $66, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $36, $66, $33, $33, $45, $21, $33, $22, $23, $33, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $77, $67, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $63, $33, $33, $45, $21, $33, $32, $33, $33, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $33, $33, $45, $21, $33, $33, $33, $33, $34, $50, + $24, $44, $44, $44, $44, $44, $52, $44, $44, $44, $44, $44, $45, $24, $44, $44, $44, $44, $44, $52, $44, $44, $44, $44, $44, $45, $24, $44, $44, $44, $44, $44, $50, + $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $50 + ); + + // 64x8 pixel 4bpp bitmap + ArrowBitmapData: array[0..255] of Byte = ( + $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $13, $33, $33, $31, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $23, $33, $33, $23, $33, $33, + $33, $33, $33, $33, $33, $33, $33, $33, $33, $31, $13, $33, $33, $31, $13, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $32, $25, $33, $33, $22, $33, $33, + $33, $31, $33, $33, $11, $11, $11, $13, $33, $11, $13, $33, $33, $31, $11, $33, $33, $32, $33, $33, $22, $22, $22, $23, $33, $22, $25, $33, $33, $22, $23, $33, + $33, $11, $13, $33, $31, $11, $11, $33, $31, $11, $13, $33, $33, $31, $11, $13, $33, $22, $23, $33, $32, $22, $22, $55, $32, $22, $25, $33, $33, $22, $22, $33, + $31, $11, $11, $33, $33, $11, $13, $33, $33, $11, $13, $33, $33, $31, $11, $33, $32, $22, $22, $33, $33, $22, $25, $53, $33, $22, $25, $33, $33, $22, $25, $53, + $11, $11, $11, $13, $33, $31, $33, $33, $33, $31, $13, $33, $33, $31, $13, $33, $22, $22, $22, $23, $33, $32, $55, $33, $33, $32, $25, $33, $33, $22, $55, $33, + $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $13, $33, $33, $31, $33, $33, $35, $55, $55, $55, $33, $33, $53, $33, $33, $33, $25, $33, $33, $25, $53, $33, + $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $35, $33, $33, $35, $33, $33 + ); + +var + PalData: array[0..7] of TGfxColor; + Palette: TGfxPalette; + Image: TFImage; +begin + inherited Create(ADisplay); + + PalData[0] := colMagenta; + PalData[1] := GetGUIColor(cl3DDkShadow); + PalData[2] := GetGUIColor(cl3DShadow); + PalData[3] := GetGUIColor(cl3DFace); + PalData[4] := GetGUIColor(cl3DLight); + PalData[5] := GetGUIColor(cl3DHighlight); + PalData[6] := GetGUIColor(clWindowText); + PalData[7] := GetGUIColor(clWindow); + + { The image canvas contains 3 horizontal stripes: + - y=0..11: Radio button images (5x 12x12 pixel) + - y=12..24: Check box images (5x 13x13 pixel) + - y=25..32: Arrow images (8x 8x8 pixel) } + +// ImageCanvas := ADisplay.DefaultScreen.CreateBitmap(65, 33); +// MaskCanvas := ADisplay.DefaultScreen.CreateMonoBitmap(12, 12); +// Palette := ADisplay.DefaultScreen.CreatePalette(8, @PalData); + + Image := TFImage.Create(60, 12, PixelFormatPal4); + Image.Palette := Palette; + Image.SetPixelsFromData(@RadioBitmapData, 30); + ImageCanvas.DrawImage(Image, Point(0, 0)); + Image.Free; + + Image := TFImage.Create(12, 12, PixelFormatMono); + Image.SetPixelsFromData(@RadioMaskData, 2); + MaskCanvas.DrawImage(Image, Point(0, 0)); + Image.Free; + + Image := TFImage.Create(66, 13, PixelFormatPal4); {!!!: width is 65, but fpGFX emulayer has a problem with odd widths} + Image.Palette := Palette; + Image.SetPixelsFromData(@CheckBoxBitmapData, 33); + ImageCanvas.DrawImage(Image, Point(0, 12)); + Image.Free; + + Image := TFImage.Create(64, 8, PixelFormatPal4); + Image.Palette := Palette; + Image.SetPixelsFromData(@ArrowBitmapData, 32); + ImageCanvas.DrawImage(Image, Point(0, 25)); + Image.Free; + + Palette.Release; +end; + +destructor TDefaultStyle.Destroy; +begin + MaskCanvas.Free; + ImageCanvas.Free; + inherited Destroy; +end; + + +// helper functions + + +{ Draws a 3D frame, its thickness is 2 pixels. The 4 given colors are used in + this way: + Color1: Outer frame left & top + Color2: Inner frame left & top + Color3: Outer frame right & bottom + Color4: Inner frame right & bottom +} + +procedure TDefaultStyle.Draw3DFrame(Canvas: TFCanvas; const ARect: TRect; + Color1, Color2, Color3, Color4: TColor); +begin + with ARect do + begin + SetUIColor(Canvas, Color1); + {Canvas.DrawPolyLine([Point(Left, Bottom - 2), TopLeft, + Point(Right - 1, Top)]);} + Canvas.DrawLine(Point(Left, Bottom - 2), TopLeft); + Canvas.DrawLine(TopLeft, Point(Right - 1, Top)); + SetUIColor(Canvas, Color2); + {Canvas.DrawPolyLine([Point(Left + 1, Bottom - 3), Point(Left + 1, Top + 1), + Point(Right - 2, Top + 1)]);} + Canvas.DrawLine(Point(Left + 1, Bottom - 3), Point(Left + 1, Top + 1)); + Canvas.DrawLine(Point(Left + 1, Top + 1), Point(Right - 2, Top + 1)); + SetUIColor(Canvas, Color3); + {Canvas.DrawPolyLine([Point(Left, Bottom - 1), Point(Right - 1, Bottom - 1), + Point(Right - 1, Top - 1)]);} + Canvas.DrawLine(Point(Left, Bottom - 1), Point(Right - 1, Bottom - 1)); + Canvas.DrawLine(Point(Right - 1, Bottom - 1), Point(Right - 1, Top - 1)); + SetUIColor(Canvas, Color4); + {Canvas.DrawPolyLine([Point(Left + 1, Bottom - 2), + Point(Right - 2, Bottom - 2), Point(Right - 2, Top)]);} + Canvas.DrawLine(Point(Left + 1, Bottom - 2), Point(Right - 2, Bottom - 2)); + Canvas.DrawLine(Point(Right - 2, Bottom - 2), Point(Right - 2, Top)); + end; +end; + +procedure TDefaultStyle.DrawSunkenOuterBorder(Canvas: TFCanvas; + const ARect: TRect); +begin + with ARect do + begin + SetUIColor(Canvas, cl3DShadow); + Canvas.DrawLine(Point(Left, Bottom - 2), TopLeft); + Canvas.DrawLine(TopLeft, Point(Right, Top)); + SetUIColor(Canvas, cl3DHighlight); + Canvas.DrawLine(Point(Left, Bottom - 1), Point(Right - 1, Bottom - 1)); + Canvas.DrawLine(Point(Right - 1, Bottom - 1), Point(Right - 1, Top - 1)); + end; +end; + +procedure TDefaultStyle.DrawRaisedOuterBorder(Canvas: TFCanvas; + const ARect: TRect); +begin + with ARect do + begin + SetUIColor(Canvas, cl3DHighlight); + Canvas.DrawLine(Point(Left, Bottom - 2), TopLeft); + Canvas.DrawLine(TopLeft, Point(Right, Top)); + SetUIColor(Canvas, cl3DShadow); + Canvas.DrawLine(Point(Left, Bottom - 1), Point(Right - 1, Bottom - 1)); + Canvas.DrawLine(Point(Right - 1, Bottom - 1), Point(Right - 1, Top - 1)); + end; +end; + +procedure TDefaultStyle.DrawText(Canvas: TFCanvas; const APosition: TPoint; + const AText: String; State: TWidgetState); +begin + if not (wsEnabled in State) then + begin + SetUIColor(Canvas, cl3DHighlight); + Canvas.TextOut(APosition + Point(1, 1), AText); + SetUIColor(Canvas, cl3DShadow); + end; + Canvas.TextOut(APosition, AText); +end; + +procedure TDefaultStyle.DrawItemBefore(Canvas: TFCanvas; const ARect: TRect; + Flags: TItemFlags); +begin + if ifSelected in Flags then + begin + SetUIColor(Canvas, clHighlight); + Canvas.FillRect(ARect); + SetUIColor(Canvas, clHighlightText); + end; +end; + +procedure TDefaultStyle.DrawItemAfter(Canvas: TFCanvas; const ARect: TRect; + Flags: TItemFlags); +begin + if ifFocused in Flags then + DrawFocusRect(Canvas, ARect); +end; + +procedure TDefaultStyle.DrawWindowBackground(Canvas: TFCanvas; + const ARect: TRect); +begin + SetUIColor(Canvas, cl3DFace); + Canvas.FillRect(ARect); +end; + +procedure TDefaultStyle.DrawButtonFace(Canvas: TFCanvas; const ARect: TRect; + Flags: TButtonFlags); +var + r: TRect; +begin + r := ARect; + + if btnIsSelected in Flags then + begin + SetUIColor(Canvas, cl3DDkShadow); + Canvas.DrawRect(r); + Inc(r.Left); + Inc(r.Top); + Dec(r.Right); + Dec(r.Bottom); + end; + + if btnIsPressed in Flags then + begin + SetUIColor(Canvas, cl3DShadow); + Canvas.DrawRect(r); + Inc(r.Left); + Inc(r.Top); + Dec(r.Right); + Dec(r.Bottom); + end else + begin + if btnIsEmbedded in Flags then + Draw3DFrame(Canvas, r, cl3DLight, cl3DHighlight, cl3DDkShadow, cl3DShadow) + else + Draw3DFrame(Canvas, r, cl3DHighlight, cl3DLight, cl3DDkShadow, cl3DShadow); + Inc(r.Left, 2); + Inc(r.Top, 2); + Dec(r.Right, 2); + Dec(r.Bottom, 2); + end; + + SetUIColor(Canvas, cl3DFace); + Canvas.FillRect(r); + + if btnHasFocus in Flags then + begin + r.Left := ARect.Left + 4; + r.Top := ARect.Top + 4; + r.Right := ARect.Right - 4; + r.Bottom := ARect.Bottom - 4; + DrawFocusRect(Canvas, r); + end; +end; + +function TDefaultStyle.GetButtonBorders: TRect; +begin + Result := Rect(5, 5, 5, 5); +end; + +function TDefaultStyle.GetSeparatorSize: Integer; +begin + Result := 2; +end; + +procedure TDefaultStyle.DrawSeparator(Canvas: TFCanvas; const ARect: TRect; + AOrientation: TOrientation); +var + r: TRect; +begin + with ARect do + if AOrientation = Horizontal then + r := Rect(Left, Top + (Bottom - Top) div 2 - 1, Right, + Top + (Bottom - Top) div 2 + 1) + else + r := Rect(Left + (Right - Left) div 2 - 1, Top, + Left + (Right - Left) div 2 + 1, Bottom); + DrawSunkenOuterBorder(Canvas, r); +end; + +procedure TDefaultStyle.DrawGroupBox(Canvas: TFCanvas; const ARect: TRect; + const ALabel: String; WidgetState: TWidgetState); +var + TitleWidth, TitleHeight, TopLine: Integer; +begin + TitleWidth := Canvas.TextWidth(ALabel); + TitleHeight := Canvas.FontCellHeight; + TopLine := ARect.Top + TitleHeight div 3; + + SetUIColor(Canvas, cl3DHighlight); +{ with ARect do + Canvas.DrawPolyLine([Point(Left + TitleWidth + 10, TopLine + 1), + Point(Right - 1, TopLine + 1), + Point(Right - 1, Bottom - 1), + Point(Left + 1, Bottom - 1), + Point(Left + 1, TopLine + 1), + Point(Left + 8, TopLine + 1)]); +} + with ARect do + begin + Canvas.DrawLine(Point(Left + TitleWidth + 10, TopLine + 1), Point(Right - 1, TopLine + 1)); { top - right of text } + Canvas.DrawLine(Point(Right - 1, TopLine + 1), Point(Right - 1, Bottom - 1)); { right } + Canvas.DrawLine(Point(Right - 1, Bottom - 1), Point(Left + 1, Bottom - 1)); { bottom } + Canvas.DrawLine(Point(Left + 1, Bottom - 1), Point(Left + 1, TopLine + 1)); { left } + Canvas.DrawLine(Point(Left + 1, TopLine + 1), Point(Left + 8, TopLine + 1)); { top - left of text } + end; + + SetUIColor(Canvas, cl3DShadow); +{ with ARect do + Canvas.DrawPolyLine([Left + TitleWidth + 10, TopLine, + Right - 2, TopLine, + Right - 2, Bottom - 2, + Left, Bottom - 2, + Left, TopLine, + Left + 8, TopLine]);} + with ARect do + begin + Canvas.DrawLine(Point(Left + TitleWidth + 10, TopLine), Point(Right - 2, TopLine)); + Canvas.DrawLine(Point(Right - 2, TopLine), Point(Right - 2, Bottom - 2)); + Canvas.DrawLine(Point(Right - 2, Bottom - 2), Point(Left, Bottom - 2)); + Canvas.DrawLine(Point(Left, Bottom - 2), Point(Left, TopLine)); + Canvas.DrawLine(Point(Left, TopLine), Point(Left + 8, TopLine)); + end; + + SetUIColor(Canvas, clWindowText); + if ALabel <> '' then + DrawText(Canvas, ARect.TopLeft + Point(9, 0), ALabel, WidgetState); +end; + +function TDefaultStyle.GetGroupBoxBorders(Canvas: TFCanvas; + const ALabel: String; var LabelWidth: Integer): TRect; +begin + Result := Rect(6, Canvas.FontCellHeight + 4, 6, 6); + LabelWidth := Canvas.TextWidth(ALabel) + 6; +end; + +procedure TDefaultStyle.DrawEditBox(Canvas: TFCanvas; const ARect: TRect); +begin + Draw3DFrame(Canvas, ARect, cl3DShadow, cl3DDkShadow, cl3DHighlight, cl3DFace); + SetUIColor(Canvas, clWindow); + with ARect do + Canvas.FillRect(Rect(Left + 2, Top + 2, Right - 2, Bottom - 2)); +end; + +function TDefaultStyle.GetEditBoxBorders: TRect; +begin + Result := Rect(2, 2, 2, 2); +end; + +procedure TDefaultStyle.DrawCheckBox(Canvas: TFCanvas; + const ARect, LabelRect: TRect; Flags: TCheckboxFlags); +var + Index, BoxY: Integer; +begin + SetUIColor(Canvas, cl3DFace); + Canvas.FillRect(ARect); + with ARect do + begin + BoxY := Top + (Bottom - Top - 13) div 2; + if cbIsEnabled in Flags then + begin + Index := Ord(cbIsChecked in Flags); + if cbIsPressed in Flags then + Inc(Index, 2); + end else + Index := 2 + Ord(cbIsChecked in Flags) * 2; + Canvas.CopyRect(ImageCanvas, Rect(Index * 13, 12, (Index + 1) * 13, 25), + Point(Left, BoxY)); + end; + + if cbHasFocus in Flags then + with LabelRect do + DrawFocusRect(Canvas, Rect(Left - 2, Top - 2, Right + 2, Bottom + 2)); +end; + +procedure TDefaultStyle.GetCheckBoxLayout(const LabelSize: TSize; + var TotalSize: TSize; var LabelPos: TPoint); +begin + TotalSize := gfxbase.Size(LabelSize.cx + 21, Max(13, LabelSize.cy + 4)); + LabelPos := Point(19, (TotalSize.cy - LabelSize.cy) div 2); +end; + + +procedure TDefaultStyle.DrawRadioButton(Canvas: TFCanvas; + const ARect, LabelRect: TRect; Flags: TCheckboxFlags); +var + Index, BtnY: Integer; +begin + with ARect do + begin + BtnY := Top + (Bottom - Top - 12) div 2; + if cbIsEnabled in Flags then + begin + Index := Ord(cbIsChecked in Flags); + if cbIsPressed in Flags then + Inc(Index, 2); + end else + Index := 2 + Ord(cbIsChecked in Flags) * 2; + Canvas.MaskedCopyRect(ImageCanvas, MaskCanvas, + Rect(Index * 12, 0, (Index + 1) * 12, 12), + Point(0, 0), Point(Left, BtnY)); + end; + if cbHasFocus in Flags then + with LabelRect do + DrawFocusRect(Canvas, Rect(Left - 2, Top - 2, Right + 2, Bottom + 2)); +end; + + +procedure TDefaultStyle.GetRadioButtonLayout(const LabelSize: TSize; + var TotalSize: TSize; var LabelPos: TPoint); +begin + TotalSize := gfxbase.Size(LabelSize.cx + 20, Max(12, LabelSize.cy + 4)); + LabelPos := Point(18, (TotalSize.cy - LabelSize.cy) div 2); +end; + + +function TDefaultStyle.GetComboBoxArrowSize: TSize; +begin + Result := gfxbase.Size(16, 17); +end; + + +procedure TDefaultStyle.DrawComboBoxArrow(Canvas: TFCanvas; + const ARect: TRect; IsPressed, IsEnabled: Boolean); +var + Pt: TPoint; + Index: Integer; +begin + with ARect do + Pt := TopLeft + Point((Right - Left - 8) div 2, (Bottom - Top - 8) div 2); + + if IsPressed then + Pt := Pt + Point(1, 1); + + Index := 1 + Ord(not IsEnabled) * 4; + Canvas.CopyRect(ImageCanvas, Rect(Index * 8, 25, (Index + 1) * 8, 33), Pt); +end; + + +function TDefaultStyle.GetScrollBarBorders(Orientation: TOrientation): TRect; +begin + Result := Rect(1, 1, 1, 1); +end; + + +function TDefaultStyle.GetScrollBarBtnSize(Orientation: TOrientation): TSize; +begin + Result.cx := 16; + Result.cy := 16; +end; + + +function TDefaultStyle.GetScrollBarBtnMinSize: Integer; +begin + Result := 30; +end; + + +procedure TDefaultStyle.DrawScrollBarBorder(Canvas: TFCanvas; + const ARect: TRect); +begin + with ARect do + begin + SetUIColor(Canvas, cl3DShadow); +{ Canvas.DrawPolyLine([Left, Bottom - 1, Left, Top, Right, Top]);} + Canvas.DrawLine(Point(Left, Bottom - 1), TopLeft); + Canvas.DrawLine(TopLeft, Point(Right, Top)); + SetUIColor(Canvas, cl3DHighlight); +{ Canvas.DrawPolyLine([Left + 1, Bottom - 1, Right - 1, Bottom - 1, + Right - 1, Top]);} + Canvas.DrawLine(Point(Left + 1, Bottom - 1), Point(Right - 1, Bottom - 1)); + Canvas.DrawLine(Point(Right - 1, Bottom - 1), Point(Right - 1, Top)); + SetUIColor(Canvas, cl3DFace); + Canvas.FillRect(Rect(Left, Bottom - 1, Left + 1, Bottom)); + Canvas.FillRect(Rect(Right - 1, Top, Right, Top + 1)); + end; +end; + + +procedure TDefaultStyle.DrawScrollBarButton(Canvas: TFCanvas; + const ARect: TRect; Direction: TArrowDirection; + IsPressed, IsEnabled: Boolean); +var + Index: Integer; +begin + Index := Ord(Direction) + Ord(not IsEnabled) * 4; + with ARect do + Canvas.CopyRect( + ImageCanvas, + Rect(Index * 8, 25, (Index + 1) * 8, 33), + TopLeft + Point((Right - Left - 8) div 2, (Bottom - Top - 8) div 2)); +end; + + +function TDefaultStyle.GetScrollBoxBorders: TRect; +begin + Result := Rect(2, 2, 2, 2); +end; + + +procedure TDefaultStyle.DrawScrollBoxBorder(Canvas: TFCanvas; const ARect: TRect); +begin + Draw3DFrame(Canvas, ARect, cl3DShadow, cl3DDkShadow, + cl3DHighlight, cl3DLight); +end; + + +function TDefaultStyle.GetMenuBorders(pCanvas: TFCanvas; const pText: string; + var pTextWidth: Integer): TRect; +begin + pTextWidth := pCanvas.TextWidth(pText) + 6; +// Result := Rect(2, 2, 6, pCanvas.FontCellHeight+4); + Result := Rect(6, 2, 2, 2); +// Result := Rect(6, pCanvas.FontCellHeight + 4, 6, 6); +end; + +function TDefaultStyle.GetPanelBorders: TRect; +begin + Result := Rect(5, 5, 5, 5); +end; + +procedure TDefaultStyle.DrawPanel(Canvas: TFCanvas; const ARect: TRect; + ABevelStyle: TBevelStyle); +begin + // bsPlain, bsLowered, bsRaised + if ABevelStyle = bsPlain then + DrawWindowBackground(Canvas, ARect) + else if ABevelStyle = bsLowered then + DrawSunkenOuterBorder(Canvas, ARect) + else + DrawRaisedOuterBorder(Canvas, ARect); +// Draw3DFrame(Canvas, ARect, cl3DHighlight, cl3DFace, cl3DFace, cl3DShadow); +end; + + +{ MotifStyle } + +procedure TMotifStyle.DrawButtonFace(Canvas: TFCanvas; const ARect: TRect; + Flags: TButtonFlags); +var + r: TRect; +begin + r := ARect; + + if btnIsSelected in Flags then + begin + SetUIColor(Canvas, cl3DDkShadow); + Canvas.DrawRect(r); + Inc(r.Left); + Inc(r.Top); + Dec(r.Right); + Dec(r.Bottom); + end; + + if btnIsPressed in Flags then + begin + SetUIColor(Canvas, cl3DShadow); + Canvas.DrawRect(r); + Inc(r.Left); + Inc(r.Top); + Dec(r.Right); + Dec(r.Bottom); + end else + begin + if btnIsEmbedded in Flags then + Draw3DFrame(Canvas, r, cl3DLight, cl3DHighlight, cl3DDkShadow, cl3DShadow) + else + Draw3DFrame(Canvas, r, cl3DHighlight, cl3DLight, cl3DDkShadow, cl3DShadow); + Inc(r.Left, 2); + Inc(r.Top, 2); + Dec(r.Right, 2); + Dec(r.Bottom, 2); + end; + + SetUIColor(Canvas, cl3DFace); + Canvas.FillRect(r); + + if btnHasFocus in Flags then + begin + r.Left := ARect.Left + 4; + r.Top := ARect.Top + 4; + r.Right := ARect.Right - 4; + r.Bottom := ARect.Bottom - 4; + DrawFocusRect(Canvas, r); + end; +end; + + +procedure TMotifStyle.DrawFocusRect(Canvas: TFCanvas; const ARect: TRect); +begin + SetUIColor(Canvas, clGray); + Canvas.DrawRect(ARect); +end; + + +procedure TMotifStyle.DrawCheckBox(Canvas: TFCanvas; const ARect, + LabelRect: TRect; Flags: TCheckboxFlags); +begin + inherited DrawCheckBox(Canvas, ARect, LabelRect, Flags); +end; + + + +{$ENDIF read_implementation} + diff --git a/gui/stylemanager.pas b/gui/stylemanager.pas new file mode 100644 index 00000000..299083d1 --- /dev/null +++ b/gui/stylemanager.pas @@ -0,0 +1,74 @@ +unit stylemanager; + +{$mode objfpc}{$H+} + +interface + +uses + Classes + ,fpGUI + ; + +type + TStyleManager = class(TObject) + private + FDefaultStyle: TStyle; + FUserStyle: TStyle; + function GetDefaultStyle: TStyle; + public + property DefaultStyle: TStyle read GetDefaultStyle; + procedure SetStyle(pNewStyle: TStyle); + end; + + +// lazy mans singleton +function gStyleManager: TStyleManager; + + +implementation +uses + fpGFX + ; + +var + uStyleManager: TStyleManager; + + +{ Creation is deferred to the first request } +function gStyleManager: TStyleManager; +begin + if uStyleManager = nil then + uStyleManager := TStyleManager.Create; + result := uStyleManager; +end; + +{ TStyleManager } + +function TStyleManager.GetDefaultStyle: TStyle; +begin + if Assigned(FUserStyle) then + Result := FUserStyle + else + begin + if not Assigned(FDefaultStyle) then + FDefaultStyle := TDefaultStyle.Create(gApplication); + Result := FDefaultStyle; + end; +end; + +procedure TStyleManager.SetStyle(pNewStyle: TStyle); +begin + if Assigned(FUserStyle) then + FUserStyle.Free; + FUserStyle := pNewStyle; +end; + + +initialization + uStyleManager := nil; + +finalization + uStyleManager.Free; + +end. + diff --git a/gui/widget.inc b/gui/widget.inc new file mode 100644 index 00000000..dc4da7be --- /dev/null +++ b/gui/widget.inc @@ -0,0 +1,1356 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Basic events and Widget class declarations + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{%mainunit fpgui.pp} + +{$IFDEF read_interface} + +{ Basic events and widget declarations } + + +// ------------------------------------------------------------------- +// Basic event objects +// ------------------------------------------------------------------- + + {$M+} + { Basic/Abstract event object which has RTTI enabled. This object does some + kind of reference counting as well. } + TEventObj = class + private + RefCount: LongInt; + FSender: TObject; + public + constructor Create(ASender: TObject); + procedure AddRef; + procedure Release; + function SendToChild(AChild: TWidget): Boolean; virtual; + published + property Sender: TObject read FSender write FSender; + end; + {$M-} + + TEventClass = class of TEventObj; + + // Miscellaneous events + + TLayoutingEventObj = class(TEventObj); + + TCalcSizesEventObj = class(TLayoutingEventObj); + + TResizedEventObj = class(TLayoutingEventObj) + private + FIsForced: Boolean; + public + constructor Create(ASender: TObject; AIsForced: Boolean); + published + property IsForced: Boolean read FIsForced write FIsForced; + end; + + + TDestroyEventObj = class(TEventObj); + TEnabledChangeEventObj = class(TEventObj); + TVisibilityChangeEventObj = class(TEventObj); + + + TPaintingEventObj = class(TEventObj) + private + FCanvas: TFCanvas; + public + constructor Create(ASender: TObject; ACanvas: TFCanvas); + published + property Canvas: TFCanvas read FCanvas write FCanvas; + end; + + + TPreparePaintEventObj = class(TPaintingEventObj) + public + // To prevent invisible children to be processed: + function SendToChild(AChild: TWidget): Boolean; override; + end; + + + TPaintEventObj = class(TPaintingEventObj) + public + // To adapt the clipping region and add a translation: + function SendToChild(AChild: TWidget): Boolean; override; + end; + + + // Mouse events + + TMouseEventObj = class(TEventObj) + private + FShift: TShiftState; + FPosition: TPoint; + public + constructor Create(ASender: TObject; AShift: TShiftState; APosition: TPoint); + function SendToChild(AChild: TWidget): Boolean; override; + property Position: TPoint read FPosition write FPosition; + published + property Shift: TShiftState read FShift write FShift; + end; + + + TMouseButtonEventObj = class(TMouseEventObj) + private + FButton: TMouseButton; + public + constructor Create(ASender: TObject; AButton: TMouseButton; + AShift: TShiftState; APosition: TPoint); + published + property Button: TMouseButton read FButton write FButton; + end; + + + TMousePressedEventObj = class(TMouseButtonEventObj); + TMouseReleasedEventObj = class(TMouseButtonEventObj); + + + TMouseMoveEventObj = class(TMouseEventObj) + public + function SendToChild(AChild: TWidget): Boolean; override; + end; + + + TMouseEnterEventObj = class(TMouseEventObj) + public + NewCursor: TGfxCursor; + end; + + + TMouseLeaveEventObj = class(TEventObj) + public + function SendToChild(AChild: TWidget): Boolean; override; + end; + + + TMouseLeaveCheckEventObj = class(TMouseEventObj) + public + function SendToChild(AChild: TWidget): Boolean; override; + NewCursor: TGfxCursor; + end; + + + TMouseWheelEventObj = class(TMouseEventObj) + private + FWheelDelta: Single; + public + constructor Create(ASender: TObject; AShift: TShiftState; + AWheelDelta: Single; APosition: TPoint); + published + property WheelDelta: Single read FWheelDelta write FWheelDelta; + end; + + +// ------------------------------------------------------------------- +// TWidget +// ------------------------------------------------------------------- + + TWidgetStyle = set of (wsCaptureMouse, wsClickable, wsOpaque); + + TContainerWidget = class; + + + TWidget = class(TComponent) + private + FParent: TWidget; + FOnClick: TNotifyEvent; + // Property access + procedure SetParent(AParent: TWidget); + function GetBoundsRect: TRect; + function GetLeft: Integer; + function GetTop: Integer; + function GetWidth: Integer; + function GetHeight: Integer; + procedure SetEnabled(AEnabled: Boolean); + procedure SetStyle(const AValue: TStyle); + procedure SetVisible(AVisible: Boolean); + // Event handling + function EvCalcSizes(Event: TCalcSizesEventObj): Boolean; + function EvEnabledChange(Event: TEnabledChangeEventObj): Boolean; + function EvVisibilityChange(Event: TVisibilityChangeEventObj): Boolean; + function EvMousePressed(Event: TMousePressedEventObj): Boolean; + function EvMouseReleased(Event: TMouseReleasedEventObj): Boolean; + function EvMouseEnter(Event: TMouseEnterEventObj): Boolean; + function EvMouseLeave(Event: TMouseLeaveEventObj): Boolean; + function EvMouseLeaveCheck(Event: TMouseLeaveCheckEventObj): Boolean; + protected + FCursor: TGfxCursor; + FText: String; + FStyle: TStyle; + FCanExpandHeight: Boolean; + FCanExpandWidth: Boolean; + FEnabled: Boolean; + FVisible: Boolean; + FOrigin: TPoint; + FBoundsSize: TSize; + FClientRect: TRect; + FMinSize, FMaxSize, FDefSize: TSize; + WidgetStyle: TWidgetStyle; + WidgetState: TWidgetState; + procedure Loaded; override; + procedure Click; dynamic; + procedure Paint(Canvas: TFCanvas); virtual; + procedure SetParentComponent(AParent: TComponent); override; + + // Layouting + procedure CalcSizes; virtual; abstract; + procedure Resized; virtual; + + // Events + function ProcessEvent(Event: TEventObj): Boolean; virtual; + function DistributeEvent(Event: TEventObj): Boolean; virtual; + procedure EvFocusChanged; dynamic; // Widget got or lost focus + procedure EvKeyPressed(Key: Word; Shift: TShiftState); dynamic; + procedure EvKeyReleased(Key: Word; Shift: TShiftState); dynamic; + procedure EvKeyChar(KeyChar: Char); dynamic; + procedure EvTextChanged; dynamic; + function DoMouseEnter(AShift: TShiftState; AMousePos: TPoint): Boolean; + + // Properties + function GetStyle: TStyle; + procedure SetCanExpandWidth(allow: Boolean); + procedure SetCanExpandHeight(allow: Boolean); + procedure SetText(const AText: String); virtual; + property CanExpandWidth: Boolean read FCanExpandWidth write SetCanExpandWidth default False; + property CanExpandHeight: Boolean read FCanExpandHeight write SetCanExpandHeight default False; + property Cursor: TGfxCursor read FCursor write FCursor default crDefault; + property Text: String read FText write SetText; + property OnClick: TNotifyEvent read FOnClick write FOnClick; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function SendEvent(Event: TEventObj): Boolean; + function FindForm: TCustomForm; + procedure SetEmbeddedParent(AParent: TWidget); + procedure SetBounds(APosition: TPoint; ASize: TSize); + procedure SetBounds(x, y, w, h: Integer); overload; + function WidgetToClient(const APoint: TPoint): TPoint; virtual; + function ClientToWidget(const APoint: TPoint): TPoint; virtual; + function ClientToScreen(const APoint: TPoint): TPoint; virtual; + procedure Show; dynamic; + procedure Hide; dynamic; + procedure Redraw; + procedure Redraw(const ARect: TRect); + procedure Scroll(const ARect: TRect; DeltaX, DeltaY: Integer); + procedure SetFocus; + procedure Update; + property Parent: TWidget read FParent write SetParent; + property Origin: TPoint read FOrigin; + property BoundsSize: TSize read FBoundsSize; + property BoundsRect: TRect read GetBoundsRect; + property Left: Integer read GetLeft; + property Top: Integer read GetTop; + property Width: Integer read GetWidth; + property Height: Integer read GetHeight; + property MinSize: TSize read FMinSize; + property MaxSize: TSize read FMaxSize; + property DefSize: TSize read FDefSize; + property ClientRect: TRect read FClientRect; + property Style: TStyle read GetStyle write SetStyle; + property Enabled: Boolean read FEnabled write SetEnabled default True; + property Visible: Boolean read FVisible write SetVisible default True; + end; + +{$ENDIF read_interface} + + + +{$IFDEF read_implementation} + +// ------------------------------------------------------------------- +// TEventObj +// ------------------------------------------------------------------- + +constructor TEventObj.Create(ASender: TObject); +begin + Sender := ASender; + RefCount := 1; +end; + + +procedure TEventObj.AddRef; +begin + Inc(RefCount); +end; + + +procedure TEventObj.Release; +begin + ASSERT(RefCount > 0); + Dec(RefCount); + if RefCount = 0 then + Self.Free; +end; + + +function TEventObj.SendToChild(AChild: TWidget): Boolean; +begin + Inc(RefCount); + Result := AChild.SendEvent(Self); +end; + + +// ------------------------------------------------------------------- +// Miscellaneous events +// ------------------------------------------------------------------- + +constructor TResizedEventObj.Create(ASender: TObject; AIsForced: Boolean); +begin + inherited Create(ASender); + FIsForced := AIsForced; +end; + + +function TPreparePaintEventObj.SendToChild(AChild: TWidget): Boolean; +begin + if wsIsVisible in AChild.WidgetState then + Result := inherited SendToChild(AChild) + else + Result := False; +end; + + +constructor TPaintingEventObj.Create(ASender: TObject; ACanvas: TFCanvas); +begin + inherited Create(ASender); + FCanvas := ACanvas; +end; + + +function TPaintEventObj.SendToChild(AChild: TWidget): Boolean; +var + ClientPos: TPoint; +begin + if wsIsVisible in AChild.WidgetState then + begin + Canvas.SaveState; + try + if Canvas.IntersectClipRect(AChild.BoundsRect) then + begin + ClientPos := AChild.ClientToWidget(AChild.Origin); + Canvas.AppendTranslation(ClientPos); + Result := inherited SendToChild(AChild); + end else + Result := False; + finally + Canvas.RestoreState; + end; + end else + Result := False; +end; + + +// ------------------------------------------------------------------- +// Mouse events +// ------------------------------------------------------------------- + +constructor TMouseEventObj.Create(ASender: TObject; AShift: TShiftState; + APosition: TPoint); +begin + inherited Create(ASender); + Shift := AShift; + Position := APosition; +end; + + +function TMouseEventObj.SendToChild(AChild: TWidget): Boolean; +var + OldPos, ClientPos: TPoint; +begin + if (AChild.WidgetState * [wsEnabled, wsIsVisible] = [wsEnabled, wsIsVisible]) + and ((AChild = AChild.FindForm.MouseCaptureWidget) or + PtInRect(AChild.BoundsRect, Position)) then + begin + // Store the old values, as they might get modified during AChild.SendEvent! + OldPos := Position; + ClientPos := AChild.WidgetToClient(Position); + Position := ClientPos - AChild.Origin; + Result := inherited SendToChild(AChild); + Position := OldPos; + end + else + Result := False; +end; + + +constructor TMouseButtonEventObj.Create(ASender: TObject; AButton: TMouseButton; + AShift: TShiftState; APosition: TPoint); +begin + inherited Create(ASender, AShift, APosition); + Button := AButton; +end; + + +function TMouseMoveEventObj.SendToChild(AChild: TWidget): Boolean; +begin + if AChild.WidgetState * [wsEnabled, wsIsVisible] = [wsEnabled, wsIsVisible] + then + begin + if PtInRect(AChild.BoundsRect, Position) and not + (wsMouseInside in AChild.WidgetState) then + AChild.DoMouseEnter(Shift, Position - AChild.Origin); + + Result := inherited SendToChild(AChild); + end else + Result := False; +end; + + +function TMouseLeaveEventObj.SendToChild(AChild: TWidget): Boolean; +begin + if wsMouseInside in AChild.WidgetState then + Result := inherited SendToChild(AChild) + else + Result := False; +end; + + +function TMouseLeaveCheckEventObj.SendToChild(AChild: TWidget): Boolean; +begin +(* if AChild = AChild.FindForm.MouseCaptureWidget then + WriteLn('CapturedWidget: Leave check for ', MouseX, ' / ', MouseY); + if {(AChild <> AChild.FindForm.MouseCaptureWidget) and} + ((MouseX < AChild.Left) or (MouseY < AChild.Top) or + (MouseX >= AChild.Left + AChild.Width) or + (MouseY >= AChild.Top + AChild.Height)) and + (wsMouseInside in AChild.WidgetState) then + AChild.SendEvent(TMouseLeaveEventObj.Create(Self)); +*) + + Result := inherited SendToChild(AChild); +end; + + +constructor TMouseWheelEventObj.Create(ASender: TObject; AShift: TShiftState; + AWheelDelta: Single; APosition: TPoint); +begin + inherited Create(ASender, AShift, APosition); + WheelDelta := AWheelDelta; +end; + + +// =================================================================== +// TWidget +// =================================================================== + +constructor TWidget.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + WidgetState := [wsEnabled]; + FCanExpandWidth := False; + FCanExpandHeight := False; + FEnabled := True; + FVisible := True; +end; + +destructor TWidget.Destroy; +begin + inherited Destroy; +end; + +function TWidget.SendEvent(Event: TEventObj): Boolean; +{$IFDEF TraceEvents} +var + i: Integer; +{$ENDIF} +begin +{$IFDEF TraceEvents} + for i := 1 to EventNestingLevel do + Write(' '); + WriteLn(Event.ClassName, ' event for ', Name, ':', ClassName); + Inc(EventNestingLevel); +{$ENDIF} + + Result := ProcessEvent(Event); + +{$IFDEF TraceEvents} + Dec(EventNestingLevel); + for i := 1 to EventNestingLevel do + Write(' '); + if Result then + WriteLn(Event.ClassName, ' event has been blocked.'); +{$ENDIF} + Event.Release; +end; + +function TWidget.FindForm: TCustomForm; +var + Widget: TWidget; +begin + Widget := Self; + while not (Widget is TCustomForm) do + begin + Widget := Widget.Parent; + if not Assigned(Widget) then + begin + Result := nil; + exit; + end; + end; + Result := TCustomForm(Widget); +end; + +procedure TWidget.SetEmbeddedParent(AParent: TWidget); +begin + FParent := AParent; +end; + +procedure TWidget.SetBounds(APosition: TPoint; ASize: TSize); +begin + LAYOUTTRACE('TWidget.SetBounds for %s:%s. Old size: %dx%d, new size: %dx%d', + [Name, ClassName, BoundsSize.cx, BoundsSize.cy, ASize.cx, ASize.cy]); + FOrigin := APosition; + if ASize <> BoundsSize then + begin + FBoundsSize := ASize; + FClientRect := Rect(0, 0, BoundsSize.cx, BoundsSize.cy); + SendEvent(TResizedEventObj.Create(Self, wsSizeIsForced in WidgetState)); + end; +end; + +procedure TWidget.SetBounds(x, y, w, h: Integer); +begin + SetBounds(Point(x, y), Size(w, h)); +end; + +function TWidget.WidgetToClient(const APoint: TPoint): TPoint; +begin + // as default, the outer rectangle is identical to the client rectangle + Result := APoint; +end; + +function TWidget.ClientToWidget(const APoint: TPoint): TPoint; +begin + // as default, the outer rectangle is identical to the client rectangle + Result := APoint; +end; + +function TWidget.ClientToScreen(const APoint: TPoint): TPoint; +begin + Result := APoint + Origin; + Result := ClientToWidget(Result); + if Assigned(Parent) then + Result := Parent.ClientToScreen(Result); +end; + +{procedure TWidget.Update; +begin + LAYOUTTRACE('TWidget.Update for %s:%s', [Name, ClassName]); + if wsIsUpdating in WidgetState then + exit; + + Include(WidgetState, wsIsUpdating); + SendEvent(TUpdateEventObj.Create(Self)); + Exclude(WidgetState, wsIsUpdating); +end; + +procedure TWidget.RecalcLayout; +var + OldW, OldH: Integer; + x, y: Integer; + Widget: TWidget; +begin + if (csLoading in ComponentState) or (not Visible) then + exit; + + LAYOUTTRACE('TWidget.RecalcLayout for %s:%s', [Name, ClassName]); + + OldW := Width; + OldH := Height; + + MinW := 0; + MinH := 0; + DefW := 0; + DefH := 0; + MaxW := InfiniteSize; + MaxH := InfiniteSize; + + EvRecalcLayout; + + if MinW = 0 then MinW := 1; + if MinH = 0 then MinH := 1; + if DefW < MinW then DefW := MinW; + if DefH < MinH then DefH := MinH; + + if (not FCanExpandWidth) or (MaxW < DefW) then + MaxW := DefW; + if (not FCanExpandHeight) or (MaxH < DefH) then + MaxH := DefH; + + if (DefW < OldW) or (DefH < OldH) or ((not (wsOpaque in WidgetStyle)) and + ((DefW > OldW) or (DefH > OldH))) then + begin + x := 0; + y := 0; + Widget := Self; + while not (Widget is TCustomForm) do + begin + Inc(x, Widget.Left); + Inc(y, Widget.Top); + Widget := Widget.parent; + end; + TCustomForm(Widget).Wnd.Invalidate(Rect(x, y, + x + Max(Width, OldW), y + Max(Height, OldH))); + end; + + if Assigned(Parent) and not (wsIsUpdating in Parent.WidgetState) then + Parent.RecalcLayout; +end;} + +procedure TWidget.Show; +begin + if not Visible then + begin + LAYOUTTRACE('TWidget.Show for %s:%s', [Name, ClassName]); + FVisible := True; + if Assigned(Parent) and (wsIsVisible in Parent.WidgetState) then + begin + SendEvent(TVisibilityChangeEventObj.Create(Self)); + Parent.Update; + end; + end; +end; + +procedure TWidget.Hide; +begin + if Visible then + begin + LAYOUTTRACE('TWidget.Hide for %s:%s', [Name, ClassName]); + FVisible := False; + if wsIsVisible in WidgetState then + begin + SendEvent(TVisibilityChangeEventObj.Create(Self)); + if Assigned(Parent) then + Parent.Update; + end; + end; +end; + +procedure TWidget.Redraw; +begin + Redraw(Rect(0, 0, BoundsSize.cx, BoundsSize.cy)); +end; + +procedure TWidget.Redraw(const ARect: TRect); +var + x, y: Integer; + Form: TCustomForm; + WidgetPos, FormPos: TPoint; +begin + if not (wsIsVisible in WidgetState) then + exit; + + Form := FindForm; + WidgetPos := ClientToScreen(Point(0, 0)); + FormPos := Form.ClientToScreen(Point(0, 0)); + + x := ARect.Left + WidgetPos.x - FormPos.x; + y := ARect.Top + WidgetPos.y - FormPos.y; + Form.Wnd.Invalidate( + Rect(x, y, x + ARect.Right - ARect.Left, y + ARect.Bottom - ARect.Top)); +end; + +procedure TWidget.Scroll(const ARect: TRect; DeltaX, DeltaY: Integer); +var + r, ClipRect: TRect; + Widget: TWidget; + Form: TCustomForm; + Canvas: TFCanvas; +begin + if not (wsIsVisible in WidgetState) then + exit; + + Form := FindForm; + + { !!!: Better do real DirtyList correction, which might improve performance + a lot in some situations } + Form.Wnd.PaintInvalidRegion; + + r.Left := ARect.Left; + r.Top := ARect.Top; + Widget := Self; + Canvas := TFCanvas(Form.Wnd.Canvas); + Canvas.SaveState; + try + while Widget <> Form do + begin + ClipRect.TopLeft := Form.WidgetCoords(Widget); + ClipRect.BottomRight := ClipRect.TopLeft + Widget.BoundsSize; + Canvas.IntersectClipRect(ClipRect); + r.TopLeft := r.TopLeft + Widget.Origin + + Widget.ClientToWidget(Point(0, 0)); + Widget := Widget.Parent; + end; + + r.Right := r.Left + ARect.Right - ARect.Left; + r.Bottom := r.Top + ARect.Bottom - ARect.Top; + + ClipRect := Canvas.GetClipRect; + + { Perform a quick clipping against the ClipRect - this might reduce + the number of pixels which get copied } + if r.Left < ClipRect.Left then + r.Left := ClipRect.Left; + if r.Left + DeltaX < ClipRect.Left then + r.Left := ClipRect.Left - DeltaX; + if r.Top < ClipRect.Top then + r.Top := ClipRect.Top; + if r.Top + DeltaY < ClipRect.Top then + r.Top := ClipRect.Top - DeltaY; + if r.Right > ClipRect.Right then + r.Right := ClipRect.Right; + if r.Right + DeltaX > ClipRect.Right then + r.Right := ClipRect.Right - DeltaX; + if r.Bottom > ClipRect.Bottom then + r.Bottom := ClipRect.Bottom; + if r.Bottom + DeltaY > ClipRect.Bottom then + r.Bottom := ClipRect.Bottom - DeltaY; + + Canvas.CopyRect(Canvas, r, r.TopLeft + Point(DeltaX, DeltaY)); + finally + Canvas.RestoreState; + end; + + // Redraw the areas which has been scrolled in + with Form.WidgetCoords(Self) do + begin + Dec(ClipRect.Left, x); + Dec(ClipRect.Top, y); + Dec(ClipRect.Right, x); + Dec(ClipRect.Bottom, y); + end; + + if DeltaX <> 0 then + begin + r := ARect; + if DeltaX < 0 then // Scrolling to the left size + begin + r.Left := r.Right + DeltaX; + if r.Right > ClipRect.Right then + begin + Dec(r.Left, r.Right - ClipRect.Right); + r.Right := ClipRect.Right; + end; + end else // Scrolling to the right size + begin + r.Right := r.Left + DeltaX; + if r.Left < ClipRect.Left then + begin + Inc(r.Right, ClipRect.Left - r.Left); + r.Left := ClipRect.Left; + end; + end; + Redraw(r); + end; + + if DeltaY <> 0 then + begin + r := ARect; + if DeltaY < 0 then // Scrolling upwards + begin + r.Top := r.Bottom + DeltaY; + if r.Bottom > ClipRect.Bottom then + begin + Dec(r.Top, r.Bottom - ClipRect.Bottom); + r.Bottom := ClipRect.Bottom; + end; + end else // Scrolling downwards + begin + r.Bottom := r.Top + DeltaY; + if r.Top < ClipRect.Top then + begin + Inc(r.Bottom, ClipRect.Top - r.Top); + r.Top := ClipRect.Top; + end; + end; + Redraw(r); + end; +end; + +procedure TWidget.SetFocus; +begin + FindForm.FocusedWidget := Self; +end; + +procedure TWidget.Update; +var + PropagateUpdate: Boolean; + OldMinSize, OldMaxSize, OldDefSize: TSize; +begin + if not (wsIsVisible in WidgetState) then + exit; + + if wsSizeIsForced in WidgetState then + PropagateUpdate := True + else + begin + OldMinSize := MinSize; + OldMaxSize := MaxSize; + OldDefSize := DefSize; + SendEvent(TCalcSizesEventObj.Create(Self)); + PropagateUpdate := (OldMinSize <> MinSize) or (OldMaxSize <> MaxSize) or + (OldDefSize <> DefSize); + end; + + if PropagateUpdate and Assigned(Parent) then + Parent.Update + else + SendEvent(TResizedEventObj.Create(Self, wsSizeIsForced in WidgetState)); +end; + +procedure TWidget.Loaded; +begin + inherited Loaded; +{!!!: if not (wsEnabled in WidgetState) then + UpdateEnabledState;} +end; + +procedure TWidget.Click; +begin + Redraw; + if Assigned(OnClick) then + OnClick(Self); +end; + +procedure TWidget.Paint(Canvas: TFCanvas); +begin + // Do nothing here. +end; + +procedure TWidget.SetParentComponent(AParent: TComponent); +begin + if AParent is TContainerWidget then + SetParent(TContainerWidget(AParent)); +end; + +procedure TWidget.SetEnabled(AEnabled: Boolean); +begin + if AEnabled <> Enabled then + begin + FEnabled := AEnabled; + SendEvent(TEnabledChangeEventObj.Create(Self)); + end; +end; + +procedure TWidget.SetStyle(const AValue: TStyle); +begin + FStyle := AValue; +end; + +procedure TWidget.SetVisible(AVisible: Boolean); +begin + if AVisible then + Show + else + Hide; +end; + +procedure TWidget.Resized; +begin + // Do nothing by default +end; + +procedure TWidget.EvFocusChanged; +begin + Redraw; +end; + +procedure TWidget.EvKeyPressed(Key: Word; Shift: TShiftState); + + function SetFocusIfPossible(Widget: TWidget): Boolean; + begin + Result := (wsClickable in Widget.WidgetStyle) and + (wsEnabled in Widget.WidgetState); + if Result then + Widget.SetFocus; + end; + + function FocusFirst(Widget: TWidget): Boolean; + var + i: Integer; + Child: TWidget; + begin + Result := False; + if not Widget.InheritsFrom(TContainerWidget) then + exit; + + for i := 0 to TContainerWidget(Widget).ChildCount - 1 do + begin + Child := TContainerWidget(Widget).Children[i]; + if SetFocusIfPossible(Child) or FocusFirst(Child) then + begin + Result := True; + exit; + end; + end; + end; + + function FocusLast(Widget: TWidget): Boolean; + var + i: Integer; + Child: TWidget; + begin + Result := False; + if not Widget.InheritsFrom(TContainerWidget) then + exit; + + for i := TContainerWidget(Widget).ChildCount - 1 downto 0 do + begin + Child := TContainerWidget(Widget).Children[i]; + if SetFocusIfPossible(Child) or FocusLast(Child) then + begin + Result := True; + exit; + end; + end; + end; + +var + mshift: TShiftState; + i, j: Integer; + CurWidget: TWidget; + CurParent: TContainerWidget; +begin + // Handle focus movement keys + mshift := Shift * [ssShift, ssAlt, ssCtrl, ssMeta, ssSuper, ssHyper, ssAltGr]; + if ((mshift = []) and ((Key = keyLeft) or (Key = keyUp))) or + ((mshift = [ssShift]) and (Key = keyTab)) then + begin + if Assigned(Parent) then + begin + CurWidget := Self; + CurParent := TContainerWidget(Parent); + while Assigned(CurParent) and CurParent.InheritsFrom(TContainerWidget) do + begin + for i := CurParent.ChildCount - 1 downto 1 do + begin + if CurParent.Children[i] = CurWidget then + begin + j := i - 1; + //Dec(i); + while j >= 0 do + begin + if SetFocusIfPossible(CurParent.Children[j]) or + FocusLast(CurParent.Children[j]) then + exit; + Dec(j); + end; + break; + end; { if } + end; { for } + CurParent := TContainerWidget(CurParent.Parent); + end; { while } + end + else + begin + if FocusLast(Self) then + exit; + end; + end + else + begin + if (mshift = []) and + ((Key = keyRight) or (Key = keyDown) or (Key = keyTab)) then + begin + if Assigned(Parent) then + begin + CurWidget := Self; + CurParent := TContainerWidget(Parent); + while Assigned(CurParent) and CurParent.InheritsFrom(TContainerWidget) do + begin + for i := 0 to CurParent.ChildCount - 2 do + begin + if CurParent.Children[i] = CurWidget then + begin + j := i; + Inc(j); + while j < CurParent.ChildCount do + begin + if SetFocusIfPossible(CurParent.Children[j]) or + FocusFirst(CurParent.Children[j]) then + exit; + Inc(j); + end; + break; + end; { if } + end; { for } + CurParent := TContainerWidget(CurParent.Parent); + end; { while } + end + else + begin + if FocusFirst(Self) then + exit; + end; + end + else if (Key = Ord(' ')) and (wsClickable in WidgetStyle) then + begin + Click; + exit; + end; + end; + + if Assigned(Parent) then + Parent.EvKeyPressed(Key, Shift); +end; + +procedure TWidget.EvKeyReleased(Key: Word; Shift: TShiftState); +begin + if Assigned(Parent) then + Parent.EvKeyReleased(Key, Shift); +end; + +procedure TWidget.EvKeyChar(KeyChar: Char); +begin + if Assigned(Parent) then + Parent.EvKeyChar(KeyChar); +end; + +procedure TWidget.EvTextChanged; +begin + Update; + Redraw; +end; + +function TWidget.DoMouseEnter(AShift: TShiftState; AMousePos: TPoint): Boolean; +var + Event: TMouseEnterEventObj; +begin + Event := TMouseEnterEventObj.Create(Self, AShift, AMousePos); + Event.AddRef; + Result := SendEvent(Event); + if Event.NewCursor <> crDefault then + FindForm.Wnd.Cursor := Event.NewCursor; + Event.Free; +end; + +function TWidget.GetStyle: TStyle; +var + Widget: TWidget; +begin + if Assigned(FStyle) then + Result := FStyle + else + begin + ASSERT(Assigned(Parent)); + // Don't use recursive calls here, they are not necessary + Widget := Parent; + while not Assigned(Widget.FStyle) do + begin + Widget := Widget.Parent; + ASSERT(Assigned(Widget)); + end; + Result := Widget.FStyle; + end; +end; + +function TWidget.ProcessEvent(Event: TEventObj): Boolean; +var + Canvas: TFCanvas; + Matrix: TGfxMatrix; + ClientPos: TPoint; + PreparationEvent: TPreparePaintEventObj; +begin + // Handle events which must be processed before the children get them + if Event.InheritsFrom(TResizedEventObj) then + begin + if TResizedEventObj(Event).IsForced then + Include(WidgetState, wsSizeIsForced) + else + Exclude(WidgetState, wsSizeIsForced); + Resized; + Result := DistributeEvent(Event); + end + else if Event.InheritsFrom(TEnabledChangeEventObj) then + Result := EvEnabledChange(TEnabledChangeEventObj(Event)) + else if Event.InheritsFrom(TVisibilityChangeEventObj) then + Result := EvVisibilityChange(TVisibilityChangeEventObj(Event)) or DistributeEvent(Event) + else if Event.InheritsFrom(TMouseEnterEventObj) then + Result := EvMouseEnter(TMouseEnterEventObj(Event)) or DistributeEvent(Event) + else if Event.InheritsFrom(TPreparePaintEventObj) then + begin + Canvas := TPreparePaintEventObj(Event).Canvas; + if wsOpaque in WidgetStyle then + begin + Canvas.ExcludeClipRect(BoundsRect); + Result := False; + end + else + begin + Matrix := Canvas.Matrix; + ClientPos := ClientToWidget(Origin); + Canvas.AppendTranslation(ClientPos); + Result := DistributeEvent(Event); + Canvas.Matrix := Matrix; + end; + end + else if Event.InheritsFrom(TPaintEventObj) then + begin + Canvas := TPaintEventObj(Event).Canvas; + Canvas.SaveState; + PreparationEvent := TPreparePaintEventObj.Create(Self, Canvas); + DistributeEvent(PreparationEvent); + PreparationEvent.Release; + Paint(Canvas); + Canvas.RestoreState; + Result := DistributeEvent(Event); + end + else + begin + // First distribute the event to all children, then try to handle them here + Result := DistributeEvent(Event); + if not Result then + begin + if Event.InheritsFrom(TCalcSizesEventObj) then + EvCalcSizes(TCalcSizesEventObj(Event)) +{ if Event.InheritsFrom(TUpdateEventObj) then + Result := EvUpdate(TUpdateEventObj(Event))} + else if Event.InheritsFrom(TMousePressedEventObj) then + Result := EvMousePressed(TMousePressedEventObj(Event)) + else if Event.InheritsFrom(TMouseReleasedEventObj) then + Result := EvMouseReleased(TMouseReleasedEventObj(Event)) + else if Event.InheritsFrom(TMouseLeaveEventObj) then + Result := EvMouseLeave(TMouseLeaveEventObj(Event)) + else if Event.InheritsFrom(TMouseLeaveCheckEventObj) then + Result := EvMouseLeaveCheck(TMouseLeaveCheckEventObj(Event)); + end; + end; +end; + +function TWidget.DistributeEvent(Event: TEventObj): Boolean; +begin + // Do nothing here, as TWidget itself doesn't have children + Result := False; +end; + +procedure TWidget.SetParent(AParent: TWidget); +begin + // !!!: reparenting when changing the form is not possible + if AParent <> FParent then + begin + // Remove the widget from the old parent, if it had a parent... + if Assigned(FParent) and FParent.InheritsFrom(TContainerWidget) then + TContainerWidget(FParent).RemoveChild(Self); + + FParent := AParent; + + // ...and add it to the new parent, if existent. + if Assigned(Parent) and Parent.InheritsFrom(TContainerWidget) then + TContainerWidget(Parent).InsertChild(Self); + end; +end; + +function TWidget.GetBoundsRect: TRect; +begin + Result.TopLeft := Origin; + Result.BottomRight := Origin + BoundsSize; +end; + +function TWidget.GetLeft: Integer; +begin + Result := Origin.x; +end; + +function TWidget.GetTop: Integer; +begin + Result := Origin.y; +end; + +function TWidget.GetWidth: Integer; +begin + Result := BoundsSize.cx; +end; + +function TWidget.GetHeight: Integer; +begin + Result := BoundsSize.cy; +end; + +procedure TWidget.SetCanExpandWidth(allow: Boolean); +begin + if FCanExpandWidth <> allow then + begin + FCanExpandWidth := allow; + Update; + end; +end; + +procedure TWidget.SetCanExpandHeight(allow: Boolean); +begin + if FCanExpandHeight <> allow then + begin + FCanExpandHeight := allow; + Update; + end; +end; + +procedure TWidget.SetText(const AText: String); +begin + if AText <> Text then + begin + FText := AText; + EvTextChanged; + end; +end; + +function TWidget.EvCalcSizes(Event: TCalcSizesEventObj): Boolean; +begin + LAYOUTTRACE('TWidget.EvCalcSizes for %s:%s', [Name, ClassName]); + + FMinSize := gfxbase.Size(0, 0); + FMaxSize := gfxbase.Size(InfiniteSize, InfiniteSize); + FDefSize := gfxbase.Size(0, 0); + + CalcSizes; + + if MinSize.cx = 0 then FMinSize.cx := 1; + if MinSize.cy = 0 then FMinSize.cy := 1; + if DefSize.cx < MinSize.cx then FDefSize.cx := MinSize.cx; + if DefSize.cy < MinSize.cy then FDefSize.cy := MinSize.cy; + + if (not FCanExpandWidth) or (MaxSize.cx < DefSize.cx) then + FMaxSize.cx := DefSize.cx; + if (not FCanExpandHeight) or (MaxSize.cy < DefSize.cy) then + FMaxSize.cy := DefSize.cy; + + Result := False; +end; + +function TWidget.EvEnabledChange(Event: TEnabledChangeEventObj): Boolean; +var + NewState: Boolean; +begin + if Assigned(Parent) then + NewState := Enabled and (wsEnabled in Parent.WidgetState) + else + NewState := Enabled; + + if NewState and not (wsEnabled in WidgetState) then + begin + Include(WidgetState, wsEnabled); + Redraw; + Result := DistributeEvent(Event); + end else if (not NewState) and (wsEnabled in WidgetState) then + begin + Exclude(WidgetState, wsEnabled); + if wsHasFocus in WidgetState then + FindForm.FocusedWidget := nil; + Redraw; + Result := DistributeEvent(Event); + end else + Result := False; +end; + +function TWidget.EvVisibilityChange(Event: TVisibilityChangeEventObj): Boolean; +begin + if Visible then + begin + if (not Assigned(Parent)) or (wsIsVisible in Parent.WidgetState) then + Include(WidgetState, wsIsVisible); + end else + Exclude(WidgetState, wsIsVisible); + + Result := False; +end; + +function TWidget.EvMousePressed(Event: TMousePressedEventObj): Boolean; +begin + if (wsClickable in WidgetStyle) and (wsEnabled in WidgetState) and + (Event.Button = mbLeft) then + begin + if wsCaptureMouse in WidgetStyle then + FindForm.MouseCaptureWidget := Self; + Include(WidgetState, wsClicked); + Include(WidgetState, wsHasFocus); + SetFocus; + Redraw; + Result := True; + end + else + Result := False; +end; + +function TWidget.EvMouseReleased(Event: TMouseReleasedEventObj): Boolean; +begin + if (wsClickable in WidgetStyle) and (wsEnabled in WidgetState) and + (Event.Button = mbLeft) then + begin + if wsClicked in WidgetState then + begin + Exclude(WidgetState, wsClicked); + with Event do + if (Position.x >= 0) and (Position.y >= 0) + and (Position.x < BoundsSize.cx) + and (Position.y < BoundsSize.cy) then + Click + else + Redraw; + end; + if wsCaptureMouse in WidgetStyle then + FindForm.MouseCaptureWidget := nil; + Result := True; + end else + Result := False; +end; + +function TWidget.EvMouseEnter(Event: TMouseEnterEventObj): Boolean; +begin + Include(WidgetState, wsMouseInside); + if Cursor <> crDefault then + Event.NewCursor := Cursor; + if (wsClickable in WidgetStyle) and (wsClicked in WidgetState) and + (wsEnabled in WidgetState) then + Redraw; + Result := False; + // WriteLn('Mouse entered ', Name, ':', ClassName, '. New cursor: ', Ord(Event.NewCursor)); +end; + +function TWidget.EvMouseLeave(Event: TMouseLeaveEventObj): Boolean; +begin + Exclude(WidgetState, wsMouseInside); + if (wsClickable in WidgetStyle) and (wsClicked in WidgetState) and + (wsEnabled in WidgetState) then + Redraw; + Result := False; + // WriteLn('Mouse left ', Name, ':', ClassName); +end; + +function TWidget.EvMouseLeaveCheck(Event: TMouseLeaveCheckEventObj): Boolean; +begin + if ((Event.Position.x < 0) or (Event.Position.y < 0) or + (Event.Position.x >= BoundsSize.cx) or + (Event.Position.y >= BoundsSize.cy)) then + begin + if wsMouseInside in WidgetState then + SendEvent(TMouseLeaveEventObj.Create(Self)) + end else if (FindForm.MouseCaptureWidget = Self) and + not (wsMouseInside in WidgetState) then + SendEvent(TMouseEnterEventObj.Create(Self, Event.Shift, Event.Position)); + + if (wsMouseInside in WidgetState) and (Event.NewCursor = crDefault) and + (Cursor <> crDefault) then + begin + Event.NewCursor := Cursor; + end; + Result := False; +end; + +{$ENDIF read_implementation} + diff --git a/gui/win32/defstyle.inc b/gui/win32/defstyle.inc new file mode 100644 index 00000000..c456fdfa --- /dev/null +++ b/gui/win32/defstyle.inc @@ -0,0 +1,50 @@ +{ + fpGUI - Free Pascal Graphical User Interface + Copyright (C) 2000 - 2001 by + Areca Systems GmbH / Sebastian Guenther + Copyright (C) 2006 by Graeme Geldenhuys + member of the fpGUI development team. + + Default style implementation for Win32 + + See the file COPYING.fpGUI, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +{$DEFINE Has_DefaultStyle_GetGUIColor} + +function TDefaultStyle.GetGUIColor(Color: TColor): TGfxColor; +begin + Color := Windows.GetSysColor(Color and $ffff); + Result.Red := (Color and $ff) * 257; + Result.Green := ((Color shr 8) and $ff) * 257; + Result.Blue := ((Color shr 16) and $ff) * 257; + Result.Alpha := 0; +end; + + +{$DEFINE Has_DefaultStyle_DrawFocusRect} + +procedure TDefaultStyle.DrawFocusRect(Canvas: TFCanvas; const ARect: TRect); +var + Rect: Windows.TRect; +begin + if Canvas.InheritsFrom(TGDICanvas) then + begin + Rect := RectToWinRect(Canvas.Transform(ARect)); + Windows.DrawFocusRect(TGDICanvas(Canvas).Handle, Rect) + end + else + begin + Canvas.SetColor(GetGUIColor(clGray)); + Canvas.DrawRect(ARect); + end; +end; + + diff --git a/img/Makefile b/img/Makefile new file mode 100644 index 00000000..bd5ea0f9 --- /dev/null +++ b/img/Makefile @@ -0,0 +1,1284 @@ +# +# Makefile generated by fpcmake v1.00 [2000/12/19] +# + +defaultrule: all + +##################################################################### +# Autodetect OS (Linux or Dos or Windows NT or OS/2) +# define inUnix when running under Unix (Linux,FreeBSD) +# define inWinNT when running under WinNT +# define inOS2 when running under OS/2 +##################################################################### + +# We need only / in the path +override PATH:=$(subst \,/,$(PATH)) + +# Search for PWD and determine also if we are under linux +PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH))))) +ifeq ($(PWD),) +PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH))))) +ifeq ($(PWD),) +nopwd: + @echo You need the GNU utils package to use this Makefile! + @echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip + @exit +else +inUnix=1 +PWD:=$(firstword $(PWD)) +endif +else +PWD:=$(firstword $(PWD)) +endif + +# Detect NT - NT sets OS to Windows_NT +# Detect OS/2 - OS/2 has OS2_SHELL defined +ifndef inUnix +ifeq ($(OS),Windows_NT) +inWinNT=1 +else +ifdef OS2_SHELL +inOS2=1 +endif +endif +endif + +# The extension of executables +ifdef inUnix +SRCEXEEXT= +else +SRCEXEEXT=.exe +endif + +# The path which is searched separated by spaces +ifdef inUnix +SEARCHPATH=$(subst :, ,$(PATH)) +else +SEARCHPATH=$(subst ;, ,$(PATH)) +endif + +# Base dir +ifdef PWD +BASEDIR:=$(shell $(PWD)) +else +BASEDIR=. +endif + +##################################################################### +# FPC version/target Detection +##################################################################### + +# What compiler to use ? +ifndef FPC +# Compatibility with old makefiles +ifdef PP +FPC=$(PP) +else +FPC=ppc386 +endif +endif +override FPC:=$(subst $(SRCEXEEXT),,$(FPC)) +override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT) + +# Target OS +ifndef OS_TARGET +OS_TARGET:=$(shell $(FPC) -iTO) +endif + +# Source OS +ifndef OS_SOURCE +OS_SOURCE:=$(shell $(FPC) -iSO) +endif + +# Target CPU +ifndef CPU_TARGET +CPU_TARGET:=$(shell $(FPC) -iTP) +endif + +# Source CPU +ifndef CPU_SOURCE +CPU_SOURCE:=$(shell $(FPC) -iSP) +endif + +# FPC version +ifndef FPC_VERSION +FPC_VERSION:=$(shell $(FPC) -iV) +endif + +export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION + +##################################################################### +# FPCDIR Setting +##################################################################### + +# Test FPCDIR to look if the RTL dir exists +ifdef FPCDIR +override FPCDIR:=$(subst \,/,$(FPCDIR)) +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +else +override FPCDIR=wrong +endif + +# Default FPCDIR +ifeq ($(FPCDIR),wrong) +override FPCDIR=../../../fpc +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=wrong +endif +endif +endif + +# Detect FPCDIR +ifeq ($(FPCDIR),wrong) +ifdef inUnix +override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=/usr/lib/fpc/$(FPC_VERSION) +endif +else +override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH)))))) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR:=$(FPCDIR)/.. +ifeq ($(wildcard $(FPCDIR)/rtl),) +ifeq ($(wildcard $(FPCDIR)/units),) +override FPCDIR=c:/pp +endif +endif +endif +endif +endif +endif + +ifndef PACKAGESDIR +PACKAGESDIR=$(FPCDIR)/packages +endif +ifndef TOOLKITSDIR +TOOLKITSDIR= +endif +ifndef COMPONENTSDIR +COMPONENTSDIR= +endif + +# Create units dir +ifneq ($(FPCDIR),.) +UNITSDIR=$(FPCDIR)/units/$(OS_TARGET) +endif + +##################################################################### +# User Settings +##################################################################### + + +# Targets + +override UNITOBJECTS+=imageio fpimg bmpreader +override RSTOBJECTS+=imageio + +# Clean + + +# Install + +ZIPTARGET=install + +# Defaults + +override NEEDOPT=-S2h + +# Directories + +override NEEDUNITDIR=../../fpgfx/src + +# Packages + +override PACKAGES+=rtl fpgfx + +# Libraries + +LIBNAME=fpimg + +# Info + +INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall + +##################################################################### +# Shell tools +##################################################################### + +# echo +ifndef ECHO +ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ECHO),) +ECHO:=echo +ECHOE:=echo +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +else +ECHO:=$(firstword $(ECHO)) +ECHOE=$(ECHO) -E +endif +endif + +# To copy pograms +ifndef COPY +COPY:=cp -fp +endif + +# Copy a whole tree +ifndef COPYTREE +COPYTREE:=cp -rfp +endif + +# To move pograms +ifndef MOVE +MOVE:=mv -f +endif + +# Check delete program +ifndef DEL +DEL:=rm -f +endif + +# Check deltree program +ifndef DELTREE +DELTREE:=rm -rf +endif + +# To install files +ifndef INSTALL +ifdef inUnix +INSTALL:=install -c -m 644 +else +INSTALL:=$(COPY) +endif +endif + +# To install programs +ifndef INSTALLEXE +ifdef inUnix +INSTALLEXE:=install -c -m 755 +else +INSTALLEXE:=$(COPY) +endif +endif + +# To make a directory. +ifndef MKDIR +ifdef inUnix +MKDIR:=install -m 755 -d +else +MKDIR:=ginstall -m 755 -d +endif +endif + +export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR + +##################################################################### +# Default Tools +##################################################################### + +# assembler, redefine it if cross compiling +ifndef AS +AS=as +endif + +# linker, but probably not used +ifndef LD +LD=ld +endif + +# ppas.bat / ppas.sh +ifdef inUnix +PPAS=ppas.sh +else +ifdef inOS2 +PPAS=ppas.cmd +else +PPAS=ppas.bat +endif +endif + +# ldconfig to rebuild .so cache +ifdef inUnix +LDCONFIG=ldconfig +else +LDCONFIG= +endif + +# ppumove +ifndef PPUMOVE +PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUMOVE),) +PPUMOVE= +else +PPUMOVE:=$(firstword $(PPUMOVE)) +endif +endif +export PPUMOVE + +# ppufiles +ifndef PPUFILES +PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(PPUFILES),) +PPUFILES= +else +PPUFILES:=$(firstword $(PPUFILES)) +endif +endif +export PPUFILES + +# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase +# upx uses that one itself (PFV) +ifndef UPXPROG +ifeq ($(OS_TARGET),go32v2) +UPXPROG:=1 +endif +ifeq ($(OS_TARGET),win32) +UPXPROG:=1 +endif +ifdef UPXPROG +UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(UPXPROG),) +UPXPROG= +else +UPXPROG:=$(firstword $(UPXPROG)) +endif +else +UPXPROG= +endif +endif +export UPXPROG + +# ZipProg, you can't use Zip as the var name (PFV) +ifndef ZIPPROG +ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(ZIPPROG),) +ZIPPROG= +else +ZIPPROG:=$(firstword $(ZIPPROG)) +endif +endif +export ZIPPROG + +ZIPOPT=-9 +ZIPEXT=.zip + +# Tar +ifndef TARPROG +TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH)))) +ifeq ($(TARPROG),) +TARPROG= +else +TARPROG:=$(firstword $(TARPROG)) +endif +endif +export TARPROG + +ifeq ($(USETAR),bz2) +TAROPT=vI +TAREXT=.tar.bz2 +else +TAROPT=vz +TAREXT=.tar.gz +endif + +##################################################################### +# Default extensions +##################################################################### + +# Default needed extensions (Go32v2,Linux) +LOADEREXT=.as +EXEEXT=.exe +PPLEXT=.ppl +PPUEXT=.ppu +OEXT=.o +ASMEXT=.s +SMARTEXT=.sl +STATICLIBEXT=.a +SHAREDLIBEXT=.so +RSTEXT=.rst +FPCMADE=fpcmade + +# Go32v1 +ifeq ($(OS_TARGET),go32v1) +PPUEXT=.pp1 +OEXT=.o1 +ASMEXT=.s1 +SMARTEXT=.sl1 +STATICLIBEXT=.a1 +SHAREDLIBEXT=.so1 +FPCMADE=fpcmade.v1 +endif + +# Go32v2 +ifeq ($(OS_TARGET),go32v2) +FPCMADE=fpcmade.dos +endif + +# Linux +ifeq ($(OS_TARGET),linux) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.lnx +endif + +# Linux +ifeq ($(OS_TARGET),freebsd) +EXEEXT= +HASSHAREDLIB=1 +FPCMADE=fpcmade.freebsd +endif + +# Win32 +ifeq ($(OS_TARGET),win32) +PPUEXT=.ppw +OEXT=.ow +ASMEXT=.sw +SMARTEXT=.slw +STATICLIBEXT=.aw +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.w32 +endif + +# OS/2 +ifeq ($(OS_TARGET),os2) +PPUEXT=.ppo +ASMEXT=.so2 +OEXT=.oo2 +SMARTEXT=.so +STATICLIBEXT=.ao2 +SHAREDLIBEXT=.dll +FPCMADE=fpcmade.os2 +endif + +# library prefix +LIBPREFIX=lib +ifeq ($(OS_TARGET),go32v2) +LIBPREFIX= +endif +ifeq ($(OS_TARGET),go32v1) +LIBPREFIX= +endif + +# determine which .pas extension is used +ifndef PASEXT +ifdef EXEOBJECTS +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS))))) +else +override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS))))) +endif +ifeq ($(TESTPAS),) +PASEXT=.pp +else +PASEXT=.pas +endif +endif + + +# Check if the dirs really exists, else turn it off +ifeq ($(wildcard $(UNITSDIR)),) +UNITSDIR= +endif +ifeq ($(wildcard $(TOOLKITSDIR)),) +TOOLKITSDIR= +endif +ifeq ($(wildcard $(PACKAGESDIR)),) +PACKAGESDIR= +endif +ifeq ($(wildcard $(COMPONENTSDIR)),) +COMPONENTSDIR= +endif + + +# PACKAGESDIR packages + +PACKAGERTL=1 +PACKAGEFPGFX=1 + +ifdef PACKAGERTL +ifneq ($(wildcard $(FPCDIR)/rtl),) +ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),) +PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET) +else +PACKAGEDIR_RTL=$(FPCDIR)/rtl +endif +ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_rtl +package_rtl: + $(MAKE) -C $(PACKAGEDIR_RTL) all +endif +UNITDIR_RTL=$(PACKAGEDIR_RTL) +else +PACKAGEDIR_RTL= +ifneq ($(wildcard $(UNITSDIR)/rtl),) +ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),) +UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET) +else +UNITDIR_RTL=$(UNITSDIR)/rtl +endif +else +UNITDIR_RTL= +endif +endif +ifdef UNITDIR_RTL +override NEEDUNITDIR+=$(UNITDIR_RTL) +endif +endif +ifdef PACKAGEFPGFX +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx),) +ifneq ($(wildcard $(PACKAGESDIR)/fpgfx/$(OS_TARGET)),) +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx/$(OS_TARGET) +else +PACKAGEDIR_FPGFX=$(PACKAGESDIR)/fpgfx +endif +ifeq ($(wildcard $(PACKAGEDIR_FPGFX)/$(FPCMADE)),) +override COMPILEPACKAGES+=package_fpgfx +package_fpgfx: + $(MAKE) -C $(PACKAGEDIR_FPGFX) all +endif +UNITDIR_FPGFX=$(PACKAGEDIR_FPGFX) +else +PACKAGEDIR_FPGFX= +ifneq ($(wildcard $(UNITSDIR)/fpgfx),) +ifneq ($(wildcard $(UNITSDIR)/fpgfx/$(OS_TARGET)),) +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx/$(OS_TARGET) +else +UNITDIR_FPGFX=$(UNITSDIR)/fpgfx +endif +else +UNITDIR_FPGFX= +endif +endif +ifdef UNITDIR_FPGFX +override NEEDUNITDIR+=$(UNITDIR_FPGFX) +endif +endif + + +##################################################################### +# Default Directories +##################################################################### + +# Linux and freebsd use unix dirs with /usr/bin, /usr/lib +# When zipping use the target as default, when normal install then +# use the source os as default +ifdef ZIPNAME +# Zipinstall +ifeq ($(OS_TARGET),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_TARGET),freebsd) +UNIXINSTALLDIR=1 +endif +else +# Normal install +ifeq ($(OS_SOURCE),linux) +UNIXINSTALLDIR=1 +endif +ifeq ($(OS_SOURCE),freebsd) +UNIXINSTALLDIR=1 +endif +endif + +# set the prefix directory where to install everything +ifndef PREFIXINSTALLDIR +ifdef UNIXINSTALLDIR +PREFIXINSTALLDIR=/usr +else +PREFIXINSTALLDIR=/pp +endif +endif +export PREFIXINSTALLDIR + +# Where to place the resulting zip files +ifndef DESTZIPDIR +DESTZIPDIR:=$(BASEDIR) +endif +export DESTZIPDIR + +##################################################################### +# Install Directories +##################################################################### + +# set the base directory where to install everything +ifndef BASEINSTALLDIR +ifdef UNIXINSTALLDIR +BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION) +else +BASEINSTALLDIR=$(PREFIXINSTALLDIR) +endif +endif + +# set the directory where to install the binaries +ifndef BININSTALLDIR +ifdef UNIXINSTALLDIR +BININSTALLDIR=$(PREFIXINSTALLDIR)/bin +else +BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET) +endif +endif + +# set the directory where to install the units. +ifndef UNITINSTALLDIR +UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET) +ifdef UNITSUBDIR +UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR) +endif +endif + +# Where to install shared libraries +ifndef LIBINSTALLDIR +ifdef UNIXINSTALLDIR +LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib +else +LIBINSTALLDIR=$(UNITINSTALLDIR) +endif +endif + +# Where the source files will be stored +ifndef SOURCEINSTALLDIR +ifdef UNIXINSTALLDIR +SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION) +else +SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source +endif +ifdef SOURCESUBDIR +SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR) +endif +endif + +# Where the doc files will be stored +ifndef DOCINSTALLDIR +ifdef UNIXINSTALLDIR +DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION) +else +DOCINSTALLDIR=$(BASEINSTALLDIR)/doc +endif +endif + +# Where to install the examples, under linux we use the doc dir +# because the copytree command will create a subdir itself +ifndef EXAMPLEINSTALLDIR +ifdef UNIXINSTALLDIR +EXAMPLEINSTALLDIR=$(DOCINSTALLDIR)/examples +else +EXAMPLEINSTALLDIR=$(BASEINSTALLDIR)/examples +endif +ifdef EXAMPLESUBDIR +EXAMPLEINSTALLDIR:=$(EXAMPLEINSTALLDIR)/$(EXAMPLESUBDIR) +endif +endif + +# Where the some extra (data)files will be stored +ifndef DATAINSTALLDIR +DATAINSTALLDIR=$(BASEINSTALLDIR) +endif + +##################################################################### +# Redirection +##################################################################### + +ifndef REDIRFILE +REDIRFILE=log +endif + +ifdef REDIR +ifndef inUnix +override FPC=redir -eo $(FPC) +endif +# set the verbosity to max +override FPCOPT+=-va +override REDIR:= >> $(REDIRFILE) +endif + + +##################################################################### +# Compiler Command Line +##################################################################### + +# Load commandline OPTDEF and add FPC_CPU define +override FPCOPTDEF:=-d$(CPU_TARGET) + +# Load commandline OPT and add target and unit dir to be sure +ifneq ($(OS_TARGET),$(OS_SOURCE)) +override FPCOPT+=-T$(OS_TARGET) +endif + +# User dirs should be first, so they are looked at first +ifdef UNITDIR +override FPCOPT+=$(addprefix -Fu,$(UNITDIR)) +endif +ifdef LIBDIR +override FPCOPT+=$(addprefix -Fl,$(LIBDIR)) +endif +ifdef OBJDIR +override FPCOPT+=$(addprefix -Fo,$(OBJDIR)) +endif +ifdef INCDIR +override FPCOPT+=$(addprefix -Fi,$(INCDIR)) +endif + +# Smartlinking +ifdef LINKSMART +override FPCOPT+=-XX +endif + +# Smartlinking creation +ifdef CREATESMART +override FPCOPT+=-CX +endif + +# Debug +ifdef DEBUG +override FPCOPT+=-gl -dDEBUG +endif + +# Release mode (strip, optimize and don't load ppc386.cfg) +# 0.99.12b has a bug in the optimizer so don't use it by default +ifdef RELEASE +ifeq ($(FPC_VERSION),0.99.12) +override FPCOPT+=-Xs -OGp3 -n +else +override FPCOPT+=-Xs -OG2p3 -n +endif +endif + +# Strip +ifdef STRIP +override FPCOPT+=-Xs +endif + +# Optimizer +ifdef OPTIMIZE +override FPCOPT+=-OG2p3 +endif + +# Verbose settings (warning,note,info) +ifdef VERBOSE +override FPCOPT+=-vwni +endif + +ifdef NEEDOPT +override FPCOPT+=$(NEEDOPT) +endif + +ifdef NEEDUNITDIR +override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR)) +endif + +ifdef UNITSDIR +override FPCOPT+=-Fu$(UNITSDIR) +endif + +# Target dirs and the prefix to use for clean/install +ifdef TARGETDIR +override FPCOPT+=-FE$(TARGETDIR) +ifeq ($(TARGETDIR),.) +override TARGETDIRPREFIX= +else +override TARGETDIRPREFIX=$(TARGETDIR)/ +endif +endif +ifdef UNITTARGETDIR +override FPCOPT+=-FU$(UNITTARGETDIR) +ifeq ($(UNITTARGETDIR),.) +override UNITTARGETDIRPREFIX= +else +override UNITTARGETDIRPREFIX=$(TARGETDIR)/ +endif +else +ifdef TARGETDIR +override UNITTARGETDIR=$(TARGETDIR) +override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX) +endif +endif + +# Add commandline options last so they can override +ifdef OPT +override FPCOPT+=$(OPT) +endif + +# Add defines from FPCOPTDEF to FPCOPT +ifdef FPCOPTDEF +override FPCOPT+=$(FPCOPTDEF) +endif + +# Error file ? +ifdef ERRORFILE +override FPCOPT+=-Fr$(ERRORFILE) +endif + +# Was a config file specified ? +ifdef CFGFILE +override FPCOPT+=@$(CFGFILE) +endif + +# For win32 the options are passed using the environment FPCEXTCMD +ifeq ($(OS_SOURCE),win32) +override FPCEXTCMD:=$(FPCOPT) +override FPCOPT:=!FPCEXTCMD +export FPCEXTCMD +endif + +# Compiler commandline +override COMPILER:=$(FPC) $(FPCOPT) + +# also call ppas if with command option -s +# but only if the OS_SOURCE and OS_TARGE are equal +ifeq (,$(findstring -s ,$(COMPILER))) +EXECPPAS= +else +ifeq ($(OS_SOURCE),$(OS_TARGET)) +EXECPPAS:=@$(PPAS) +endif +endif + +##################################################################### +# Standard rules +##################################################################### + +all: fpc_all + +debug: fpc_debug + +smart: fpc_smart + +shared: fpc_shared + +showinstall: fpc_showinstall + +install: fpc_install + +sourceinstall: fpc_sourceinstall + +exampleinstall: fpc_exampleinstall + +zipinstall: fpc_zipinstall + +zipsourceinstall: fpc_zipsourceinstall + +zipexampleinstall: fpc_zipexampleinstall + +clean: fpc_clean + +distclean: fpc_distclean + +cleanall: fpc_cleanall + +info: fpc_info + +.PHONY: all debug smart shared showinstall install sourceinstall exampleinstall zipinstall zipsourceinstall zipexampleinstall clean distclean cleanall info + +##################################################################### +# Units +##################################################################### + +.PHONY: fpc_units + +override ALLTARGET+=fpc_units + +override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS)) +override INSTALLPPUFILES+=$(UNITPPUFILES) +override CLEANPPUFILES+=$(UNITPPUFILES) + +fpc_units: $(UNITPPUFILES) + +##################################################################### +# Resource strings +##################################################################### + +ifdef RSTOBJECTS +override RSTFILES=$(addsuffix $(RSTEXT),$(RSTOBJECTS)) + +override CLEANRSTFILES+=$(RSTFILES) +endif + +##################################################################### +# General compile rules +##################################################################### + +.PHONY: fpc_packages fpc_all fpc_debug + +$(FPCMADE): $(ALLTARGET) + @$(ECHO) Compiled > $(FPCMADE) + +fpc_packages: $(COMPILEPACKAGES) + +fpc_all: fpc_packages $(FPCMADE) + +fpc_debug: + $(MAKE) all DEBUG=1 + +# Search paths for .ppu if targetdir is set +ifdef UNITTARGETDIR +vpath %$(PPUEXT) $(UNITTARGETDIR) +endif + +# General compile rules, available for both possible PASEXT + +.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp + +%$(PPUEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(PPUEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pp + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +%$(EXEEXT): %.pas + $(COMPILER) $< $(REDIR) + $(EXECPPAS) + +##################################################################### +# Library +##################################################################### + +.PHONY: fpc_smart fpc_shared + +ifdef LIBVERSION +LIBFULLNAME=$(LIBNAME).$(LIBVERSION) +else +LIBFULLNAME=$(LIBNAME) +endif + +# Default sharedlib units are all unit objects +ifndef SHAREDLIBUNITOBJECTS +SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS) +endif + +fpc_smart: + $(MAKE) all LINKSMART=1 CREATESMART=1 + +fpc_shared: all +ifdef HASSHAREDLIB +ifndef LIBNAME + @$(ECHO) "LIBNAME not set" +else + $(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBFULLNAME) +endif +else + @$(ECHO) "Shared Libraries not supported" +endif + +##################################################################### +# Install rules +##################################################################### + +.PHONY: fpc_showinstall fpc_install + +ifdef EXTRAINSTALLUNITS +override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS)) +endif + +ifdef INSTALLPPUFILES +override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES)) +ifdef PPUFILES +INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)) +else +INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))) +endif +override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)) +endif + +ifdef INSTALLEXEFILES +override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES)) +endif + +fpc_showinstall: $(SHOWINSTALLTARGET) +ifdef INSTALLEXEFILES + @$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES)) +endif +ifdef INSTALLPPUFILES + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES)) +ifneq ($(INSTALLPPULINKFILES),) + @$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES)) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + @$(ECHO) $(LIBINSTALLDIR)/$(LIBFULLNAME) +ifdef HASSHAREDLIB + @$(ECHO) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + @$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES)) +endif + +fpc_install: $(INSTALLTARGET) +# Create UnitInstallFiles +ifdef INSTALLEXEFILES + $(MKDIR) $(BININSTALLDIR) +# Compress the exes if upx is defined +ifdef UPXPROG + -$(UPXPROG) $(INSTALLEXEFILES) +endif + $(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR) +endif +ifdef INSTALLPPUFILES + $(MKDIR) $(UNITINSTALLDIR) + $(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR) +ifneq ($(INSTALLPPULINKFILES),) + $(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR) +endif +ifneq ($(wildcard $(LIBFULLNAME)),) + $(MKDIR) $(LIBINSTALLDIR) + $(INSTALL) $(LIBFULLNAME) $(LIBINSTALLDIR) +ifdef inUnix + ln -sf $(LIBFULLNAME) $(LIBINSTALLDIR)/$(LIBNAME) +endif +endif +endif +ifdef EXTRAINSTALLFILES + $(MKDIR) $(DATAINSTALLDIR) + $(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR) +endif + +##################################################################### +# SourceInstall rules +##################################################################### + +.PHONY: fpc_sourceinstall + +ifndef SOURCETOPDIR +SOURCETOPDIR=$(BASEDIR) +endif + +fpc_sourceinstall: clean + $(MKDIR) $(SOURCEINSTALLDIR) + $(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR) + +##################################################################### +# exampleinstall rules +##################################################################### + +.PHONY: fpc_exampleinstall + +fpc_exampleinstall: $(addsuffix _clean,$(EXAMPLEDIROBJECTS)) +ifdef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) + $(COPY) $(EXAMPLESOURCEFILES) $(EXAMPLEINSTALLDIR) +endif +ifdef EXAMPLEDIROBJECTS +ifndef EXAMPLESOURCEFILES + $(MKDIR) $(EXAMPLEINSTALLDIR) +endif + $(COPYTREE) $(addsuffix /*,$(EXAMPLEDIROBJECTS)) $(EXAMPLEINSTALLDIR) +endif + +##################################################################### +# Zip +##################################################################### + +.PHONY: fpc_zipinstall + +# Create suffix to add +ifndef PACKAGESUFFIX +PACKAGESUFFIX=$(OS_TARGET) +ifeq ($(OS_TARGET),go32v2) +PACKAGESUFFIX=go32 +endif +ifeq ($(OS_TARGET),win32) +PACKAGESUFFIX=w32 +endif +ifeq ($(OS_TARGET),os2) +PACKAGESUFFIX=emx +endif +endif + +# Temporary path to pack a file +ifndef PACKDIR +ifndef inUnix +PACKDIR=$(BASEDIR)/pack_tmp +else +PACKDIR=/tmp/fpc-pack +endif +endif + +# Maybe create default zipname from packagename +ifndef ZIPNAME +ifdef PACKAGENAME +ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX) +endif +endif + +# Use tar by default under linux +ifndef USEZIP +ifdef inUnix +USETAR=1 +endif +endif + +fpc_zipinstall: +ifndef ZIPNAME + @$(ECHO) "Please specify ZIPNAME!" + @exit 1 +else + $(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR) +ifdef USETAR + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) + cd $(PACKDIR) ; $(TARPROG) cf$(TAROPT) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR) +else + $(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) + cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR) +endif + $(DELTREE) $(PACKDIR) +endif + +.PHONY: fpc_zipsourceinstall + +fpc_zipsourceinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src + +.PHONY: fpc_zipexampleinstall + +fpc_zipexampleinstall: + $(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall PACKAGESUFFIX=exm + +##################################################################### +# Clean rules +##################################################################### + +.PHONY: fpc_clean fpc_cleanall fpc_distclean + +ifdef EXEFILES +override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES)) +endif + +ifdef EXTRACLEANUNITS +override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS)) +endif + +ifdef CLEANPPUFILES +override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES)) +# Get the .o and .a files created for the units +ifdef PPUFILES +CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES)) +else +CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))) +endif +override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)) +endif + +fpc_clean: $(CLEANTARGET) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif +ifdef CLEANPPUFILES + -$(DEL) $(CLEANPPUFILES) +endif +ifneq ($(CLEANPPULINKFILES),) + -$(DEL) $(CLEANPPULINKFILES) +endif +ifdef CLEANRSTFILES + -$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES)) +endif +ifdef EXTRACLEANFILES + -$(DEL) $(EXTRACLEANFILES) +endif +ifdef LIBNAME + -$(DEL) $(LIBNAME) $(LIBFULLNAME) +endif + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +fpc_distclean: fpc_clean + +# Also run clean first if targetdir is set. Unittargetdir is always +# set if targetdir or unittargetdir is specified +ifdef UNITTARGETDIR +TARGETDIRCLEAN=fpc_clean +endif + +fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN) +ifdef CLEANEXEFILES + -$(DEL) $(CLEANEXEFILES) +endif + -$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT) + -$(DELTREE) *$(SMARTEXT) + -$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE) + +##################################################################### +# Info rules +##################################################################### + +.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \ + fpc_dirinfo + +fpc_info: $(INFOTARGET) + +fpc_infocfg: + @$(ECHO) + @$(ECHO) == Configuration info == + @$(ECHO) + @$(ECHO) FPC....... $(FPC) + @$(ECHO) Version... $(FPC_VERSION) + @$(ECHO) CPU....... $(CPU_TARGET) + @$(ECHO) Source.... $(OS_SOURCE) + @$(ECHO) Target.... $(OS_TARGET) + @$(ECHO) + +fpc_infoobjects: + @$(ECHO) + @$(ECHO) == Object info == + @$(ECHO) + @$(ECHO) LoaderObjects..... $(LOADEROBJECTS) + @$(ECHO) UnitObjects....... $(UNITOBJECTS) + @$(ECHO) ExeObjects........ $(EXEOBJECTS) + @$(ECHO) + @$(ECHO) ExtraCleanUnits... $(EXTRACLEANUNITS) + @$(ECHO) ExtraCleanFiles... $(EXTRACLEANFILES) + @$(ECHO) + @$(ECHO) ExtraInstallUnits. $(EXTRAINSTALLUNITS) + @$(ECHO) ExtraInstallFiles. $(EXTRAINSTALLFILES) + @$(ECHO) + +fpc_infoinstall: + @$(ECHO) + @$(ECHO) == Install info == + @$(ECHO) +ifdef DATE + @$(ECHO) DateStr.............. $(DATESTR) +endif +ifdef PACKAGEPREFIX + @$(ECHO) PackagePrefix........ $(PACKAGEPREFIX) +endif +ifdef PACKAGENAME + @$(ECHO) PackageName.......... $(PACKAGENAME) +endif + @$(ECHO) PackageSuffix........ $(PACKAGESUFFIX) + @$(ECHO) + @$(ECHO) BaseInstallDir....... $(BASEINSTALLDIR) + @$(ECHO) BinInstallDir........ $(BININSTALLDIR) + @$(ECHO) LibInstallDir........ $(LIBINSTALLDIR) + @$(ECHO) UnitInstallDir....... $(UNITINSTALLDIR) + @$(ECHO) SourceInstallDir..... $(SOURCEINSTALLDIR) + @$(ECHO) DocInstallDir........ $(DOCINSTALLDIR) + @$(ECHO) DataInstallDir....... $(DATAINSTALLDIR) + @$(ECHO) + @$(ECHO) DestZipDir........... $(DESTZIPDIR) + @$(ECHO) ZipName.............. $(ZIPNAME) + @$(ECHO) + +##################################################################### +# Local Makefile +##################################################################### + +ifneq ($(wildcard fpcmake.loc),) +include fpcmake.loc +endif + diff --git a/img/Makefile.fpc b/img/Makefile.fpc new file mode 100644 index 00000000..dc06233a --- /dev/null +++ b/img/Makefile.fpc @@ -0,0 +1,18 @@ +# +# Makefile.fpc for fpImg +# + +[targets] +units=imageio fpimg bmpreader +rst=imageio + +[require] +options=-S2h +packages=fpgfx + +[libs] +libname=fpimg + +[dirs] +fpcdir=../../../fpc +unitdir=../../fpgfx/src diff --git a/img/bmpreader.pas b/img/bmpreader.pas new file mode 100644 index 00000000..71d7ee73 --- /dev/null +++ b/img/bmpreader.pas @@ -0,0 +1,308 @@ +{ + fpImg - Free Pascal Imaging Library + Copyright (C) 2000 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + + Image reader for BMP files + + See the file COPYING, included in this distribution, + for details about the copyright. + + 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. +} + + +unit BMPReader; + +{$IFDEF Debug} +{$ASSERTIONS On} +{$ENDIF} + +interface + +uses Classes, GFXBase, ImageIO; + +type + DWORD = LongWord; + LONG = LongInt; + + TBitmapFileHeader = packed record + bfType: WORD; + bfSize: DWORD; + bfReserved1: WORD; + bfReserved2: WORD; + bfOffBits: DWORD; + end; + + TBitmapInfoHeader = packed record + biSize: DWORD; + biWidth: LONG; + biHeight: LONG; + biPlanes: WORD; + biBitCount: WORD; + biCompression: DWORD; + biSizeImage: DWORD; + biXPelsPerMeter: LONG; + biYPelsPerMeter: LONG; + biClrUsed: DWORD; + biClrImportant: DWORD; + end; + + PRGBQuad = ^TRGBQuad; + TRGBQuad = packed record + rgbBlue, rgbGreen, rgbRed, rgbReserved: BYTE; + end; + + + TBMPReader = class(TImageReader) + protected + FFileHeader: TBitmapFileHeader; + FInfoHeader: TBitmapInfoHeader; + FBMPPalette: PRGBQuad; + FFileStride: LongWord; + + HeaderBytesRead, PalBytesRead: Integer; + ScanlinesLeft: Integer; + ThisSegmentHeight: Integer; + ScanlinesLeftInSegment: Integer; + ScanlineBytesDone: LongWord; + CurScanline: Pointer; + + procedure DoProcessHeaderData(AStream: TStream); override; + function DoGetImageSegmentStartY(ASegmentHeight: Integer): Integer; + override; + procedure InitImageReading; override; + procedure InitSegmentReading; + procedure DoProcessImageData(AStream: TStream); override; + public + destructor Destroy; override; + property FileHeader: TBitmapFileHeader read FFileHeader; + property InfoHeader: TBitmapInfoHeader read FInfoHeader; + property BMPPalette: PRGBQuad read FBMPPalette; + property FileStride: LongWord read FFileStride; + end; + + +implementation + + +destructor TBMPReader.Destroy; +begin + if Assigned(Palette) then + FreeMem(FPalette); + if Assigned(BMPPalette) then + FreeMem(FBMPPalette); + inherited Destroy; +end; + +procedure TBMPReader.DoProcessHeaderData(AStream: TStream); +var + DataOffset: LongWord; + HaveRead, BytesToSkip, i: Integer; + IsFirstRead: Boolean; + SkipBuffer: array[0..1023] of Byte; +begin + if HeaderBytesRead < SizeOf(FileHeader) then + begin + HaveRead := AStream.Read(PChar(@FileHeader)[HeaderBytesRead], + SizeOf(FileHeader) - HeaderBytesRead); + if HaveRead = 0 then + raise EImgOutOfData.Create; + Inc(HeaderBytesRead, HaveRead); + IsFirstRead := False; + end else + IsFirstRead := True; + + if HeaderBytesRead < SizeOf(FileHeader) + SizeOf(InfoHeader) then + begin + HaveRead := AStream.Read( + PChar(@InfoHeader)[HeaderBytesRead - SizeOf(FileHeader)], + SizeOf(FileHeader) + SizeOf(InfoHeader) - HeaderBytesRead); + if HaveRead = 0 then + if IsFirstRead then + raise EImgOutOfData.Create + else + exit; + IsFirstRead := False; + Inc(HeaderBytesRead, HaveRead); + end; + + if HeaderBytesRead = SizeOf(FileHeader) + SizeOf(InfoHeader) then + begin + case InfoHeader.biBitCount of + 1: FPaletteSize := 2; + 4: FPaletteSize := 16; + 8: FPaletteSize := 256; + end; + if PaletteSize > 0 then + begin + GetMem(FBMPPalette, PaletteSize * SizeOf(TRGBQuad)); + GetMem(FPalette, PaletteSize * SizeOf(TGfxColor)); + end; + end; + + if HeaderBytesRead >= SizeOf(FileHeader) + SizeOf(InfoHeader) then + begin + DataOffset := FileHeader.bfOffBits; + if HeaderBytesRead < DataOffset then + begin + BytesToSkip := DataOffset - HeaderBytesRead; + if BytesToSkip > SizeOf(SkipBuffer) then + BytesToSkip := SizeOf(SkipBuffer); + HaveRead := AStream.Read(SkipBuffer, BytesToSkip); + if HaveRead = 0 then + if IsFirstRead then + raise EImgOutOfData.Create + else + exit; + IsFirstRead := False; + Inc(HeaderBytesRead, HaveRead); + if PalBytesRead < PaletteSize * SizeOf(TGfxPixel) then + begin + Move(SkipBuffer, PByte(FBMPPalette)[PalBytesRead], HaveRead); + Inc(PalBytesRead, HaveRead); + end; + end; + + if HeaderBytesRead = DataOffset then + begin + FWidth := InfoHeader.biWidth; + FHeight := InfoHeader.biHeight; + + if PaletteSize > 0 then + for i := 0 to PaletteSize - 1 do + begin + Palette[i].Red := BMPPalette[i].rgbRed * 257; + Palette[i].Green := BMPPalette[i].rgbGreen * 257; + Palette[i].Blue := BMPPalette[i].rgbBlue * 257; + Palette[i].Alpha := 0; + end; + + case InfoHeader.biBitCount of + 1: + begin + FFileStride := ((Width + 31) shr 3) and not 3; + FPixelFormat.FormatType := ftMono; + end; + 4: + begin + FFileStride := ((Width + 7) shr 1) and not 3; + FPixelFormat.FormatType := ftPal4; + end; + 8: + begin + FFileStride := (Width + 3) and not 3; + FPixelFormat.FormatType := ftPal8; + end; + 24: + begin + FFileStride := (Width * 3 + 3) and not 3; + FPixelFormat := PixelFormatBGR24; + end; + else + raise EImgUnsupportedPixelFormat.Create; + end; + end; + + HeaderFinished; + end; +end; + +function TBMPReader.DoGetImageSegmentStartY(ASegmentHeight: Integer): Integer; +begin + Result := ScanlinesLeft - ASegmentHeight; + if Result < 0 then + Result := 0; +end; + +procedure TBMPReader.InitImageReading; +begin + ScanlinesLeft := Height; + InitSegmentReading; +end; + +procedure TBMPReader.InitSegmentReading; +begin + ThisSegmentHeight := ScanlinesLeft; + if ThisSegmentHeight > SegmentHeight then + ThisSegmentHeight := SegmentHeight; + ScanlinesLeftInSegment := ThisSegmentHeight; + ScanlineBytesDone := 0; + CurScanline := SegmentData + (ThisSegmentHeight - 1) * SegmentStride; +end; + +procedure TBMPReader.DoProcessImageData(AStream: TStream); + + procedure ScanlineDone; + begin + Dec(ScanlinesLeftInSegment); + Dec(ScanlinesLeft); + + if ScanlinesLeftInSegment = 0 then + begin + SegmentFinished(ScanlinesLeft, ThisSegmentHeight); + if ScanlinesLeft = 0 then + ImageFinished + else + InitSegmentReading; + end else + Dec(CurScanline, SegmentStride); + end; + +var + ReadMayFail: Boolean; + ToRead, HaveRead: Integer; +begin + if ScanlineBytesDone > 0 then + begin + ToRead := SegmentStride; + if ToRead > FileStride then + ToRead := FileStride; + Dec(ToRead, ScanlineBytesDone); + HaveRead := AStream.Read(PChar(CurScanline)[ScanlineBytesDone], ToRead); + if HaveRead = 0 then + raise EImgOutOfData.Create; + if HaveRead = ToRead then + begin + ScanlineBytesDone := 0; + ScanlineDone + end else + begin + Inc(ScanlineBytesDone, HaveRead); + exit; + end; + ReadMayFail := True; + end else + ReadMayFail := False; + + while ScanlinesLeft > 0 do + begin + ToRead := SegmentStride; + if ToRead > FileStride then + ToRead := FileStride; + + HaveRead := AStream.Read(CurScanline^, ToRead); + + if HaveRead = 0 then + if ReadMayFail then + exit + else + raise EImgOutOfData.Create; + + if HaveRead < ToRead then + begin + ScanlineBytesDone := HaveRead; + break; + end; + + // Handle the ordinary case: a full scanline has been read + if ToRead < FileStride then + AStream.Position := AStream.Position + FileStride - ToRead; + ReadMayFail := True; + ScanlineDone; + end; +end; + +end. diff --git a/img/fpimg.pas b/img/fpimg.pas new file mode 100644 index 00000000..9d9b9794 --- /dev/null +++ b/img/fpimg.pas @@ -0,0 +1,96 @@ +{ + fpImg - Free Pascal Imaging Library + Copyright (C) 2000 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + + fpImg interface declarations; + this is the main glue code between different fpImg submodules + such as ImageIO and fpGFX. + + See the file COPYING, included in this distribution, + for details about the copyright. + + 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. +} + + +unit fpImg; + +{$IFDEF Debug} +{$ASSERTIONS On} +{$ENDIF} + +interface + +uses Classes, GFXBase, ImageIO; + + +function CreateImageFromFile(AScreen: TGfxScreen; AReader: TImageReaderClass; + const AFilename: String): TGfxImage; + +function CreateImageFromStream(AScreen: TGfxScreen; AReader: TImageReaderClass; + AStream: TStream): TGfxImage; + + + +implementation + + +function CreateImageFromFile(AScreen: TGfxScreen; AReader: TImageReaderClass; + const AFilename: String): TGfxImage; +var + Stream: TFileStream; +begin + Stream := TFileStream.Create(AFilename, fmOpenRead); + try + Result := CreateImageFromStream(AScreen, AReader, Stream); + finally + Stream.Free; + end; +end; + + +function CreateImageFromStream(AScreen: TGfxScreen; AReader: TImageReaderClass; + AStream: TStream): TGfxImage; +var + Reader: TImageReader; + Data: Pointer; + Stride: LongWord; + Palette: TGfxPalette; +begin + Reader := AReader.Create; + try + Reader.ProcessHeaderData(AStream); + Result := AScreen.Display.CreateImage(Reader.Width, Reader.Height, + Reader.PixelFormat); + if Reader.PaletteSize > 0 then + begin + Palette := AScreen.CreatePalette(Reader.PaletteSize, + Reader.Palette); + try + Result.Palette := Palette; + finally + Palette.Release; + end; + end; + try + Result.Lock(Data, Stride); + try + Reader.SetImageSegmentBuffer(Data, Stride, Reader.Height); + Reader.ProcessImageData(AStream); + finally + Result.Unlock; + end; + except + Result.Free; + raise; + end; + finally + Reader.Free; + end; +end; + +end. + diff --git a/img/imageio.pas b/img/imageio.pas new file mode 100644 index 00000000..6d0f59e3 --- /dev/null +++ b/img/imageio.pas @@ -0,0 +1,199 @@ +{ + fpImg - Free Pascal Imaging Library + Copyright (C) 2000 by + Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org + + Image I/O interface declarations + + See the file COPYING, included in this distribution, + for details about the copyright. + + 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. +} + + +unit ImageIO; + +{$IFDEF Debug} +{$ASSERTIONS On} +{$ENDIF} + +interface + +uses SysUtils, Classes, GFXBase; + +resourcestring + SImgOutOfData = 'No more data available for image'; + SImgUnsupportedPixelFormat = 'Unsupported pixel format in image'; + +type + + EImgError = class(Exception); + + EImgOutOfData = class(EImgError) + public + constructor Create; + end; + + EImgUnsupportedPixelFormat = class(EImgError) + public + constructor Create; + end; + + +// Image reading + + TImageReaderClass = class of TImageReader; + + TImageReaderState = (irsStart, irsInHeader, irsHeaderRead, + irsInImage, irsFinished); + + TSegmentEvent = procedure(Sender: TObject; StartY, Height: Integer) of object; + + TImageReader = class + private + FState: TImageReaderState; + + { Needed for reading of image data. These values must be initialized by + the user via SetImageSegmentBuffer } + FSegmentData: Pointer; + FSegmentStride: LongWord; + FSegmentHeight: Integer; + FSegmentSize: LongWord; // Size in bytes + + FOnHeader: TNotifyEvent; + FOnSegment: TSegmentEvent; + FOnImage: TNotifyEvent; + protected + // Image properties, only available after OnHeaderRead event + FWidth, FHeight: Integer; + FPixelFormat: TGfxPixelFormat; + FPaletteSize: Integer; + FPalette: PGfxColor; + + procedure HeaderFinished; + procedure SegmentFinished(AStartY, AHeight: Integer); + procedure ImageFinished; + + procedure DoProcessHeaderData(AStream: TStream); virtual; abstract; + function DoGetImageSegmentStartY(ASegmentHeight: Integer): Integer; + virtual; abstract; + procedure InitImageReading; virtual; + procedure DoProcessImageData(AStream: TStream); virtual; abstract; + + public + constructor Create; virtual; + procedure ProcessHeaderData(AStream: TStream); + function GetImageSegmentStartY(ASegmentHeight: Integer): Integer; + procedure SetImageSegmentBuffer(AData: Pointer; AStride: LongWord; + ASegmentHeight: Integer); + procedure ProcessImageData(AStream: TStream); + + property State: TImageReaderState read FState; + property Width: Integer read FWidth; + property Height: Integer read FHeight; + property PixelFormat: TGfxPixelFormat read FPixelFormat; + property PaletteSize: Integer read FPaletteSize; + property Palette: PGfxColor read FPalette; + property SegmentData: Pointer read FSegmentData; + property SegmentStride: LongWord read FSegmentStride; + property SegmentHeight: Integer read FSegmentHeight; + property SegmentSize: LongWord read FSegmentSize; + + property OnHeader: TNotifyEvent read FOnHeader write FOnHeader; + property OnSegment: TSegmentEvent read FOnSegment write FOnSegment; + property OnImage: TNotifyEvent read FOnImage write FOnImage; + end; + + +implementation + +constructor EImgOutOfData.Create; +begin + inherited Create(SImgOutOfData); +end; + +constructor EImgUnsupportedPixelFormat.Create; +begin + inherited Create(SImgUnsupportedPixelFormat); +end; + + +// TImageReader + +constructor TImageReader.Create; +begin + inherited Create; +end; + +procedure TImageReader.ProcessHeaderData(AStream: TStream); +begin + ASSERT(FState in [irsStart, irsInHeader]); + if State = irsStart then + FState := irsInHeader; + DoProcessHeaderData(AStream); +end; + +function TImageReader.GetImageSegmentStartY(ASegmentHeight: Integer): Integer; +begin + ASSERT(State in [irsHeaderRead, irsInImage]); + Result := DoGetImageSegmentStartY(ASegmentHeight); +end; + +procedure TImageReader.SetImageSegmentBuffer(AData: Pointer; AStride: LongWord; + ASegmentHeight: Integer); +begin + ASSERT(State in [irsHeaderRead, irsInImage]); + FSegmentData := AData; + FSegmentStride := AStride; + FSegmentHeight := ASegmentHeight; + FSegmentSize := SegmentStride * SegmentHeight; +end; + +procedure TImageReader.ProcessImageData(AStream: TStream); +begin + if State = irsFinished then + exit; + ASSERT(State in [irsHeaderRead, irsInImage]); + + if State = irsHeaderRead then + begin + FState := irsInImage; + InitImageReading; + end; + + DoProcessImageData(AStream); +end; + +procedure TImageReader.HeaderFinished; +begin + ASSERT(FState = irsInHeader); + FState := irsHeaderRead; + if Assigned(OnHeader) then + OnHeader(Self); +end; + +procedure TImageReader.SegmentFinished(AStartY, AHeight: Integer); +begin + ASSERT(FState = irsInImage); + if Assigned(OnSegment) then + OnSegment(Self, AStartY, AHeight); +end; + +procedure TImageReader.ImageFinished; +begin + ASSERT(FState = irsInImage); + FState := irsFinished; + if Assigned(OnImage) then + OnImage(Self); +end; + +procedure TImageReader.InitImageReading; +begin + // Do nothing +end; + + +end. diff --git a/prototypes/gui1.jpg b/prototypes/gui1.jpg Binary files differnew file mode 100644 index 00000000..3157a88f --- /dev/null +++ b/prototypes/gui1.jpg diff --git a/prototypes/gui2.png b/prototypes/gui2.png Binary files differnew file mode 100644 index 00000000..74ce1aae --- /dev/null +++ b/prototypes/gui2.png diff --git a/prototypes/gui3.png b/prototypes/gui3.png Binary files differnew file mode 100644 index 00000000..22a15e7b --- /dev/null +++ b/prototypes/gui3.png |