From: Hugo Villeneuve Date: Tue, 12 Apr 2005 04:58:53 +0000 (+0000) Subject: Initial import X-Git-Tag: hvclock-0.1.0 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=c7c08260cfa6197035418fa25bd8bf6d3b8ad211;p=dockapps%2Fhvclock.git Initial import --- 8c4149720933f6b16336108be72c8052dee5479b diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..4295f32 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Author: Hugo Villeneuve (hugo@hugovil.com) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..c49bda4 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,4 @@ + +2005-04-12 Hugo Villeneuve + + * Added project to subversion diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..a4b3414 --- /dev/null +++ b/INSTALL @@ -0,0 +1,229 @@ +Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..8c6d287 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,24 @@ +## Makefile.am -- Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = gnu + +SUBDIRS = src doc + +## we want these in the dist tarball +EXTRA_DIST = autogen.sh \ + $(ac_aux_dir)/acx_pthread.m4 \ + $(ac_aux_dir)/hv-debug.m4 \ + pixmaps + +ACLOCAL = aclocal -I $(ac_aux_dir) + +CLEANFILES = *~ + +DISTCLEANFILES = .deps/*.P + +MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config-h.in \ + stamp-h.in $(ac_aux_dir)/depcomp \ + $(ac_aux_dir)/install-sh $(ac_aux_dir)/missing \ + $(ac_aux_dir)/mkinstalldirs $(ac_aux_dir)/config.guess \ + $(ac_aux_dir)/config.sub $(ac_aux_dir)/ltmain.sh + diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..3cf473c --- /dev/null +++ b/NEWS @@ -0,0 +1,3 @@ + +2003-04-02: hvclock-0.1.0 has been released. + See the file 'ChangeLog' to see what has changed since last version. diff --git a/README b/README new file mode 100644 index 0000000..99323c2 --- /dev/null +++ b/README @@ -0,0 +1,14 @@ + hvclock + +Dockable analog clock and calendar. + +Project website: + http://www.hugovil.com/en/hvclock + +This program was tested on the following systems: + "Linux From Scratch 4.0" + + +For installation instructions, see the INSTALL file. + +For recent project news, see the NEWS file. diff --git a/TODO b/TODO new file mode 100644 index 0000000..b27bd6b --- /dev/null +++ b/TODO @@ -0,0 +1,4 @@ +TODO +==== + +o Add anti-aliasing hands for the clock. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..515f88d --- /dev/null +++ b/autogen.sh @@ -0,0 +1,68 @@ +#!/bin/sh +# autogen.sh -- Use this script to create generated files from the SVN distribution +# Taken from glib CVS + +PROJECT=hvclock +TEST_TYPE=-f +TEST_FILE=src/hvclock.c + +ACLOCAL_FLAGS="${ACLOCAL_FLAGS} -I config" + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd ${srcdir} + +DIE=0 + +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed to compile $PROJECT." + echo "Download the appropriate package for your distribution," + echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" + DIE=1 +} + +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have automake installed to compile $PROJECT." + echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4.tar.gz" + echo "(or a newer version if it is available)" + DIE=1 +} + +(libtoolize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have libtool installed to compile $PROJECT." + echo "Visit http://www.gnu.org/software/libtool/ for more information." + DIE=1 +} + +if test "${DIE}" -eq 1; then + exit 1 +fi + +test ${TEST_TYPE} ${TEST_FILE} || { + echo "You must run this script in the top-level $PROJECT directory" + exit 1 +} + +case ${CC} in + *xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;; +esac + +aclocal ${ACLOCAL_FLAGS} + +#libtoolize --force --copy + +# Optionally feature autoheader +(autoheader --version) < /dev/null > /dev/null 2>&1 && autoheader + +automake --add-missing --copy ${am_opt} + +autoconf + +cd ${ORIGDIR} + +rm -rf autom4te.cache diff --git a/config/acx_pthread.m4 b/config/acx_pthread.m4 new file mode 100644 index 0000000..b3c966b --- /dev/null +++ b/config/acx_pthread.m4 @@ -0,0 +1,226 @@ +dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +dnl +dnl This macro figures out how to build C programs using POSIX +dnl threads. It sets the PTHREAD_LIBS output variable to the threads +dnl library and linker flags, and the PTHREAD_CFLAGS output variable +dnl to any special C compiler flags that are needed. (The user can also +dnl force certain compiler flags/libs to be tested by setting these +dnl environment variables.) +dnl +dnl Also sets PTHREAD_CC to any special C compiler that is needed for +dnl multi-threaded programs (defaults to the value of CC otherwise). +dnl (This is necessary on AIX to use the special cc_r compiler alias.) +dnl +dnl If you are only building threads programs, you may wish to +dnl use these variables in your default LIBS, CFLAGS, and CC: +dnl +dnl LIBS="$PTHREAD_LIBS $LIBS" +dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +dnl CC="$PTHREAD_CC" +dnl +dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute +dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE +dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +dnl +dnl ACTION-IF-FOUND is a list of shell commands to run if a threads +dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands +dnl to run it if it is not found. If ACTION-IF-FOUND is not specified, +dnl the default action will define HAVE_PTHREAD. +dnl +dnl Please let the authors know if this macro fails on any platform, +dnl or if you have any other suggestions or comments. This macro was +dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org) +dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread +dnl macros posted by AFC to the autoconf macro repository. We are also +dnl grateful for the helpful feedback of numerous users. +dnl +dnl @version $Id: acx_pthread.m4,v 1.3 2002/12/12 23:15 ac-archive-0.5.39 $ +dnl @author Steven G. Johnson and Alejandro Forero Cuervo + +AC_DEFUN([ACX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_SAVE +AC_LANG_C +acx_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on True64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) + AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) + AC_MSG_RESULT($acx_pthread_ok) + if test x"$acx_pthread_ok" = xno; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all. + +acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) +# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) +# -pthreads: Solaris/gcc +# -mthreads: Mingw32/gcc, Lynx/gcc +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads too; +# also defines -D_REENTRANT) +# pthread: Linux, etcetera +# --thread-safe: KAI C++ + +case "${host_cpu}-${host_os}" in + *solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (We need to link with -pthread or + # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather + # a function called by this macro, so we could check for that, but + # who knows whether they'll stub that too in a future libc.) So, + # we'll just look for -pthreads and -lpthread first: + + acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" + ;; +esac + +if test x"$acx_pthread_ok" = xno; then +for flag in $acx_pthread_flags; do + + case $flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $flag]) + PTHREAD_CFLAGS="$flag" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$flag]) + PTHREAD_LIBS="-l$flag" + ;; + esac + + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + AC_TRY_LINK([#include ], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); + pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], + [acx_pthread_ok=yes]) + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + AC_MSG_RESULT($acx_pthread_ok) + if test "x$acx_pthread_ok" = xyes; then + break; + fi + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$acx_pthread_ok" = xyes; then + save_LIBS="$LIBS" + LIBS="$PTHREAD_LIBS $LIBS" + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + + # Detect AIX lossage: threads are created detached by default + # and the JOINABLE attribute has a nonstandard name (UNDETACHED). + AC_MSG_CHECKING([for joinable pthread attribute]) + AC_TRY_LINK([#include ], + [int attr=PTHREAD_CREATE_JOINABLE;], + ok=PTHREAD_CREATE_JOINABLE, ok=unknown) + if test x"$ok" = xunknown; then + AC_TRY_LINK([#include ], + [int attr=PTHREAD_CREATE_UNDETACHED;], + ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) + fi + if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then + AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, + [Define to the necessary symbol if this constant + uses a non-standard name on your system.]) + fi + AC_MSG_RESULT(${ok}) + if test x"$ok" = xunknown; then + AC_MSG_WARN([we do not know how to create joinable pthreads]) + fi + + AC_MSG_CHECKING([if more special flags are required for pthreads]) + flag=no + case "${host_cpu}-${host_os}" in + *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; + *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; + esac + AC_MSG_RESULT(${flag}) + if test "x$flag" != xno; then + PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" + fi + + LIBS="$save_LIBS" + CFLAGS="$save_CFLAGS" + + # More AIX lossage: must compile with cc_r + AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) +else + PTHREAD_CC="$CC" +fi + +AC_SUBST(PTHREAD_LIBS) +AC_SUBST(PTHREAD_CFLAGS) +AC_SUBST(PTHREAD_CC) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$acx_pthread_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) + : +else + acx_pthread_ok=no + $2 +fi +AC_LANG_RESTORE +])dnl ACX_PTHREAD diff --git a/config/hv-debug.m4 b/config/hv-debug.m4 new file mode 100644 index 0000000..f8fc330 --- /dev/null +++ b/config/hv-debug.m4 @@ -0,0 +1,18 @@ +dnl +dnl Macro for adding an option to 'configure' for enabling debugging messages +dnl +AC_DEFUN([HV_CHECK_FOR_DEBUG],[ +AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], + [enable debugging messages on console + (default is NO)]),[ + if test x"${enableval}" = xyes; then + debug_messages=1 + AC_DEFINE([DEBUG],1,[Set to 1 to enable debugging messages.]) + elif test x"${enableval}" = xno; then + debug_messages=0 + else + AC_MSG_ERROR(bad value for --enable-debug option) + fi +], debug_messages=0 ) +]) + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..535a595 --- /dev/null +++ b/configure.in @@ -0,0 +1,98 @@ +# configure.in -- Process this file with autoconf to produce configure. + +dnl Initialization stuff. +AC_INIT(hvclock, 0.1.0) +AC_CONFIG_AUX_DIR(config) +AC_CONFIG_SRCDIR(src/hvclock.c) +AM_CONFIG_HEADER(config.h:config-h.in) +dnl Checking if the NEWS file has been updated to reflect the current version. +AM_INIT_AUTOMAKE(check-news) + +dnl Testing the C compiler. +AC_PROG_CC +AC_LANG_C + +dnl Checking for header files. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(stdlib.h unistd.h errno.h assert.h) +AC_CHECK_HEADERS(string.h strings.h) + +dnl Checking for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_PID_T +AC_TYPE_SIZE_T + +dnl Checks for '--enable-debug' option +HV_CHECK_FOR_DEBUG + +dnl Basic CFLAGS values +CFLAGS="${CFLAGS} -Wall" + +dnl Checking for POSIX threads library. +ACX_PTHREAD(CC="${PTHREAD_CC}" CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}" dnl + LIBS="${PTHREAD_LIBS} ${LIBS}", dnl + echo "Can't find POSIX threads library"; exit 1 ) + +dnl Trying to locate the X window system's includes and libraries, and sets the +dnl variables x_includes and x_libraries to their locations. Also adds the +dnl required include flags to X_CFLAGS and required linking flags to X_LIBS. +AC_PATH_XTRA +CFLAGS="${CFLAGS} ${X_CFLAGS}" +LIBS="${LIBS} ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" + +dnl Checking for X11 library. +AC_CHECK_LIB(X11, XOpenDisplay, LIBS="${LIBS} -lX11", + echo "Can't find X11 library" ; exit 1, "${X_LIBS}") + +dnl Checking for Xpm library and headers. +AC_CHECK_HEADERS(X11/xpm.h, ,echo "Can't find header file for library Xpm" ; exit 1) +AC_CHECK_LIB(Xpm, XpmCreatePixmapFromXpmImage, LIBS="${LIBS} -lXpm", + echo "Can't find Xpm library" ; exit 1, "${X_LIBS}") + +dnl Checking for Xext library and headers. +AC_CHECK_HEADERS(X11/extensions/shape.h, , +echo "Can't find header file for library Xext" ; exit 1) +AC_CHECK_LIB(Xext, XShapeCombineMask, LIBS="${LIBS} -lXext", + echo "Can't find Xext library" ; exit 1, "${X_LIBS}") + +dnl Checking for gdk-pixbuf library +dnl The path to 'gdk-pixbuf-config' must be in your $PATH environment variable. If not, +dnl you can try setting the $GDK_PIXBUF_CONFIG environment variable to the complete path +dnl and filename where 'gdk-pixbuf-config' is located like in this example: +dnl GDK_PIXBUF_CONFIG="/opt/gnome-1.4/bin/gdk-pixbuf-config" ./configure +AM_PATH_GDK_PIXBUF(0.7.0,,AC_MSG_ERROR([gdk-pixbuf >= 0.7.0 is required])) +CFLAGS="${CFLAGS} ${GDK_PIXBUF_CFLAGS}" +LIBS="${LIBS} ${GDK_PIXBUF_LIBS}" + +AC_CHECK_HEADERS(math.h, ,dnl +echo "Can't find header file for math library" ; exit 1) +dnl Checking for math library +AC_CHECK_LIB(m, sin, LIBS="${LIBS} -lm",dnl + echo "Can't find math library" ; exit 1, "${X_LIBS}") + +AC_SUBST(CFLAGS) +AC_SUBST(LIBS) +AC_SUBST(ac_aux_dir) + +dnl Creating output file(s) +AC_OUTPUT(Makefile src/Makefile doc/Makefile) + +dnl Output the configuration summary +echo +echo "Configuration summary:" +echo +echo " Install path: ${prefix}" +echo " Compiler: ${CC}" +echo " Compiler flags: ${CFLAGS}" +echo " Linker flags: ${LIBS}" +echo +echo -n " Debugging: " +if test x"${debug_messages}" = x1; then + echo "yes" +else + echo "no" +fi + +echo +echo "Configure finished. Type 'make' to build." diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..31edec3 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,9 @@ +## Makefile.am -- Process this file with automake to produce Makefile.in + +man1_MANS = hvclock.man + +EXTRA_DIST = $(man1_MANS) + +CLEANFILES = *~ + +MAINTAINERCLEANFILES = Makefile.in diff --git a/doc/hvclock.man b/doc/hvclock.man new file mode 100644 index 0000000..73f9f12 --- /dev/null +++ b/doc/hvclock.man @@ -0,0 +1,43 @@ +.TH HVCLOCK 1 "April 2005" "hvclock" "User's Manual" + +.SH NAME +hvclock \- Dockable analog clock and calendar + +.SH SYNOPSIS +.B hvclock +[\fIOPTION\fR]... + +.SH DESCRIPTION +\fBhvclock\fR is a dockable analog clock and calendar application (DockApps) +for the WindowMaker window manager. + +The interface is kept very simple. To switch between calendar view and +clock view, single-click on the clock or calendar image. + +.SH "OPTIONS" +.TP +.BI \-display " host" : display +Specifies the host and screen to be used by \fBhvclock\fR. By default this +is obtained from the environment variable +.SB DISPLAY. + +.TP +.BI \-geometry " geometry" +.RB ( *geometry ) +Specifies the initial geometry of the window. + +.TP +\fB\-h\fR +display usage and exit +.TP +\fB\-v\fR +output version information and exit + +.SH CREDITS +\fBhvclock\fR was written by Hugo Villeneuve . + +.SH COPYRIGHT +\fBhvclock\fR is free; anyone may redistribute it to anyone under the terms +stated in the GNU General Public License. A copy of the license is included in +the \fBhvclock\fR distribution. You can also browse it online at +.I http://www.gnu.org/copyleft/gpl.html diff --git a/pixmaps/hvclock.xpm b/pixmaps/hvclock.xpm new file mode 100644 index 0000000..bd3f805 --- /dev/null +++ b/pixmaps/hvclock.xpm @@ -0,0 +1,213 @@ +/* XPM */ +static char * hvclock_xpm[] = { +"223 148 62 1", +" c None", +". c #EFEEB3", +"+ c #D4D39F", +"@ c #9F9E77", +"# c #BAB98B", +"$ c #4F4F3B", +"% c #1B1B14", +"& c #000000", +"* c #353528", +"= c #6A6A50", +"- c #A4A1B4", +"; c #9C9DB4", +"> c #A49DB4", +", c #9C9DAC", +"' c #9C99AC", +") c #9499A4", +"! c #9C95AC", +"~ c #9495A4", +"{ c #9491A4", +"] c #8B919C", +"^ c #948DA4", +"/ c #8B8D9C", +"( c #8B899C", +"_ c #838994", +": c #8B859C", +"< c #838594", +"[ c #838194", +"} c #7B818B", +"| c #7B7D8B", +"1 c #A49DAC", +"2 c #A499AC", +"3 c #9C91AC", +"4 c #837D94", +"5 c #9495AC", +"6 c #9C99A4", +"7 c #9C95A4", +"8 c #FFFFFF", +"9 c #7B798B", +"0 c #858463", +"a c #CCCCCC", +"b c #666666", +"c c #7F7F7F", +"d c #A499B4", +"e c #737983", +"f c #B2B2B2", +"g c #7B758B", +"h c #737583", +"i c #737183", +"j c #6A717B", +"k c #736D83", +"l c #6A6D7B", +"m c #626573", +"n c #626173", +"o c #5A616A", +"p c #62616A", +"q c #5A6173", +"r c #999999", +"s c #5A5D6A", +"t c #5A596A", +"u c #525D62", +"v c #525962", +"w c #525562", +" ...................................................... .................. ............ ", +" ....+@................................................ .....#$%&&*=+..... .......*&&&. ", +" ----;->;>,;',''')!'~!~~{~{{{]{^]^///(/((_(:_:<<<<[<[}[[|[||| ----;->;>,;',''')!'~!~~{~{{{]{^]^///(/((_(:_:<<<<[<[}[[|[||| ....@&................................................ ....$&&&&&&&%@.... ......@&&&&. ", +" --->-1,,,,2,''''!'~~~~3~{&&&&&&&&&&&/((((:_<<<:<[<[[[[|}||4| --->-1,,,,2,''''!'~~~~3~{&&&&&&&&&&&/((((:_<<<:<[<[[[[|}||4| ....@&..#@#..@+@#..@+.##..@@+.+@#@##..@+.............. ...=&&&&&&&&&&#... .....+%&&&&. ", +" -->-,;>,>',''''56~575&&&&&888888888&&&&&:_<:<:<[<[[}[|}4|4|9 -->-,;>,>',''''56~575&&&&&888888888&&&&&:_<:<:<[<[[}[|}4|4|9 ....@&.0%$&=.&%$&0.&@.$$.***&#@&*00%.#&+.............. ..+&&&&&&&&&&&*... ....@%&&&&&. ", +" ->-,>1,,',''''565!&&&&8888888aba8888888&&&&<-,>1,,',''''565!&&&&8888888aba8888888&&&&<,;,d,''''565&&&8888888888b&b8888888888&&&[<[}[[|[||4|9|9 ;-,>,;,d,''''565&&&8888888888b&b8888888888&&&[<[}[[|[||4|9|9 .00.@&.0%*%$.&@.$$.&@.$$.$&$&@@&...*0*0............... ..&&&&0....*&&&=.. .=%&&&&&&&&. ", +" -1;1;1',''''565&&888888888888aba888888888888&&[[[}|[||||9|99 -1;1;1',''''565&&888888888888aba888888888888&&[[[}|[||||9|99 .=%@$%.&0.*$.&@.$$.&0+%$@&++&@@&...@*&+............... .#&&&&+....0&&&%.. .&&&&&%&&&&. ", +" >,>,,',''''~'&&&88888888888888888888888888888&&&[|[||||9|99e >,>,,',''''~'&&&88888888888888888888888888888&&&[|[||||9|99e .+*&%@.=&%$*.&@.$$.0&%*$+*&**0@&....&$................ .@&&&&.....@&&&&.. .&&&&0@&&&&. ", +" ;,,,d,''''~'&&88aba888888888&8f&&f88888888aba88&&[||||9|99e9 ;,,,d,''''~'&&88aba888888888&8f&&f88888888aba88&&[||||9|99e9 ...................................+&@................ .=&&&$......&&&&#. .&&%#.@&&&&. ", +" >,>',''''~'&&888b&b88888888&&8&88&88888888b&b888&&|||9|99e9e >,>',''''~'&&888b&b88888888&&8&88&88888888b&b888&&|||9|99e9e ..................................@&$................. .$&&&$......&&&&@. .*0...@&&&&. ", +" ,,',''''~&&&8888ab8888888888&888&&88888888aba8888&&&9|9999eg ,,',''''~&&&8888ab8888888888&888&&88888888aba8888&&&9|9999eg ...................................................... .$&&&$......&&&&@. ......@&&&&. ", +" ;2,''''~'&88888888&88&888888&8f&f88888888&888888888&|999eege ;2,''''~'&88888888&88&888888&8f&f88888888&888888888&|999eege .+@@@@+......##....................................... .$&&&$......&&&&@. ......@&&&&. ", +" ',''''~'&&8888888&&8&&888888&8&888888888&&888888888&&99e9geh ',''''~'&&8888888&&8&&888888&8&888888888&&888888888&&99e9geh .@&&&&@......$$....................................... .$&&&$......&&&&@. ......@&&&&. ", +" ,''''5'&&888888888&88&888888&8&&&&8888888&8888888888&&e9hehh ,''''5'&&888888888&88&888888&8&&&&8888888&8888888888&&e9hehh .@&......@#..$$#@..##@###.+@..#@#..@#@#@..##.......... .$&&&$......&&&&@. ......@&&&&. ", +" ''''56&&8888888888&88&8888888888888888888&88888888888&&h9hgh ''''56&&8888888888&88&8888888888888888888&88888888888&&h9hgh .@&@@@.+%**$.$%*%%.$&$#$$.@&.0%$&=.&%$+&#.%0.......... .$&&&$......&&&&@. ......@&&&&. ", +" '''565&88888888888&88&8888888888888888888&888888888888&9chhh '''565&88888888888&88&8888888888888888888&888888888888&9chhh .@&&&&.=*@@&#$*.+&@$*..$$.@&.+++*$.&0..*0+&+.......... .@&&&%.....#&&&&.. ......@&&&&. ", +" ''565&&88888888888&88&8888888888888888888&888888888888&&hhhi ''565&&88888888888&88&8888888888888888888&888888888888&&hhhi .@&....$%$$$#$$..&@$$..$$.@&.0%*%$.&@..0*0*........... .@&&&&.....@&&&&.. ......@&&&&. ", +" )!65&&8aba88888888888888888888888888888888888888888aba8&&hih )!65&&8aba88888888888888888888888888888888888888888aba8&&hih .@&....0%++#.$%+@&+$$..$*.$&.&0.*$.&@...&*0........... ..&&&&@....$&&&$.. ......@&&&&. ", +" !'~!&88b&b88888888888888888888888888888888888888888b&b88&ihi !'~!&88b&b88888888888888888888888888888888888888888b&b88&ihi .@&.....=&&*+$*%&0.$$..#%&$&.=&%$*.&@...$&............ ..*&&&%+..@&&&&0.. ......@&&&&. ", +" '~5&&88ab8&8f&&f8888888888888888888888888888888f&&8aba88&&ij '~5&&88ab8&8f&&f8888888888888888888888888888888f&&8aba88&&ij ........................................*$............ ..0&&&&&$*&&&&%... ......@&&&&. ", +" ~~7&88888&&8&88&8888888888888888888888888888888&88&888888&ji ~~7&88888&&8&88&8888888888888888888888888888888&88&888888&ji .......................................&%+............ ...*&&&&&&&&&&0... ......@&&&&. ", +" !~5&888888&8&88&888888888888888888888888888888888&&888888&ij !~5&888888&8&88&888888888888888888888888888888888&&888888&ij ...................................................... ...+%&&&&&&&&$.... ......@&&&&. ", +" ~~&&888888&8&88&8888888888888888888888888888888f&f8888888&&k ~~&&888888&8&88&8888888888888888888888888888888f&f8888888&&k .+@@..#@#................##........................... .....=&&&&&%0..... ......@&&&&. ", +" ~3&8888888&8&88&8888888888888888888888888888888&8888888888&j ~3&8888888&8&88&8888888888888888888888888888888&8888888888&j .@&&..$&$................$$........................... .......#@@#....... ............ ", +" {~&8888888&8f&&f8888888888888888888888888888888&&&&8888888&l {~&8888888&8f&&f8888888888888888888888888888888&&&&8888888&l .@&*@.&*$..@@+.+@#@..@@..$$#@......................... .................. ............ ", +" ~{&8888888888888888888888888888888888888888888888888888888&l ~{&8888888888888888888888888888888888888888888888888888888&l .@&==#%$$.***&#@&*0+%**%+$%*%*........................ ", +" {&&8888888888888888888888888888888888888888888888888888888&& {&&8888888888888888888888888888888888888888888888888888888&& .@&#$@$$$.#.#&@@&+.=*..#.$*.@&........................ ................. ................. ", +" {&888888888888888888888888888888888888888888888888888888888& {&888888888888888888888888888888888888888888888888888888888& .@&.&$@$$.$&$&@@&..$$....$$.@&........................ ....+=*&&&*=+.... .....@$&&&*0..... ", +" {&888888888888888888888888888888888888888888888888888888888& {&888888888888888888888888888888888888888888888888888888888& .@&.$%.$$@&++&@@&..0%++=+$$.@&........................ ...0&&&&&&&&&@... ...+*&&&&&&&%+... ", +" ]&88888f&&f888888888888888888888888888888888888888&&&f88888& ]&88888f&&f888888888888888888888888888888888888888&&&f88888& .@&.0*.$$+*&**0@&...=&&=.$$.@&........................ ..0&&&&&&&&&&&@.. ...%&&&&&&&&&%+.. ", +" {&8aba8&88&888888888888888888888888888888888888888888&8aba8& {&8aba8&88&888888888888888888888888888888888888888888&8aba8& ...................................................... .+&&&&&&&&&&&&&+. ..0&&&&&&&&&&&*.. ", +" ^&8b&b8&88&8888888888888888888888888888888888888888&&&8b&b8& ^&8b&b8&88&8888888888888888888888888888888888888888&&&8b&b8& ...................................................... .=&&&&$+.+$&&&&0. ..%&&&&@.+*&&&&+. ", +" ]&8aba8f&&&888888888888888888888888888888888888888888&8aba8& ]&8aba8f&&&888888888888888888888888888888888888888888&8aba8& ...................................................... .*&&&*.....%&&&$. .+&&&&0...+&&&&@. ", +" ^&88888888&888888888888888888888888888888888888888&88&88888& ^&88888888&888888888888888888888888888888888888888&88&88888& ...+@+............+@.##............................... .&&&&0.....$&&&$. .+0$$&.....&&&&@. ", +" /&88888c&&f888888888888888888888888888888888888888f&&f88888& /&88888c&&f888888888888888888888888888888888888888f&&f88888& ...*&$............#$.$$............................... ...+@+.....$&&&$. ..........+&&&&+. ", +" /&888888888888888888888888888888888888888888888888888888888& /&888888888888888888888888888888888888888888888888888888888& ..+&$&+.+@+@+.+@#@+@.$$............................... ...........&&&&@. ..........$&&&*.. ", +" /&&8888888888888888888888888888888888888888888888888888888&& /&&8888888888888888888888888888888888888888888888888888888&& ..0&.&0.@&**&+@&*0@&.$$............................... ..........0&&&&.. .......#$&&&&%+.. ", +" (/&8888888888888888888888888888888888888888888888888888888&m (/&8888888888888888888888888888888888888888888888888888888&m ..*$.=*.@&+.*=@&+.@&.$$............................... .........@&&&&=.. .......@&&&&*+... ", +" /(&8888888888888888888888888888888888888888888888888888888&m /(&8888888888888888888888888888888888888888888888888888888&m .+&&&&&+@&..$$@&..@&.$$............................... ........@&&&&%... .......=&&&&%=... ", +" ((&88888888f&&f888888888888888888888888888888888&&88888888&m ((&88888888f&&f888888888888888888888888888888888&&88888888&m .0%@@@%0@&@+%0@&..@&.$$............................... .......@&&&&&+... .......$$$&&&&%+. ", +" ((&&8888888&88&88888888888888888888888888888888&8&8888888&&m ((&&8888888&88&88888888888888888888888888888888&8&8888888&&m .*=...=*@&$&$.@&..@&.$$............................... ......@&&&&&@.... ..........+%&&&=. ", +" _(:&8888888&&&&8888888888888888888888888888888&88&8888888&mn _(:&8888888&&&&8888888888888888888888888888888&88&8888888&mn ........@&............................................ .....@&&&&%#..... ...........#&&&&+ ", +" (:_&8888888&88&8888888888888888888888888888888&&&&&888888&nm (:_&8888888&88&8888888888888888888888888888888&&&&&888888&nm ........@&............................................ ....@&&&&%+...... ............&&&&@ ", +" :_<&&88aba8&88&8888888888888888888888888888888888&8aba88&&mo :_<&&88aba8&88&8888888888888888888888888888888888&8aba88&&mo ...................................................... ...@&&&&%+....... .0$$%$......&&&&@ ", +" _<:<&88b&b8f&&f8888888888888888888888888888888888&8b&b88&mon _<:<&88b&b8f&&f8888888888888888888888888888888888&8b&b88&mon .+@@..#@#............................................. ..+%&&&%+........ .=&&&&+....@&&&&# ", +" :<<<&&8aba88888888888888888888888888888888888888888aba8&&ono :<<<&&8aba88888888888888888888888888888888888888888aba8&&ono .@&&..$&$............................................. ..*&&&&=@@@@@@@#. .#&&&&$...+%&&&&. ", +" <<:<[&&88888888888&&&&88888888888888888&&&&88888888888&&pnon <<:<[&&88888888888&&&&88888888888888888&&&&88888888888&&pnon .@&*@.&*$..@@+.##..@+................................. .#&&&&&&&&&&&&&$. ..*&&&&&$$&&&&&=. ", +" <:<[<[&88888888888&88&88888888888888888&88888888888888&pqono <:<[<[&88888888888&88&88888888888888888&88888888888888&pqono .@&==#%$$.***�%.#&+................................. .*&&&&&&&&&&&&&$. ..#&&&&&&&&&&&%.. ", +" <<[<[[&&888888888888&r88888888888888888&&&88888888888&&qpnos <<[<[[&&888888888888&r88888888888888888&&&88888888888&&qpnos .@&#$@$$$.#.#&@+&+0*.................................. .&&&&&&&&&&&&&&$. ...@&&&&&&&&&*+.. ", +" <[<[}[[&&8888888888r&8888888f&&c8888888888&888888888&&qpqoso <[<[}[[&&8888888888r&8888888f&&c8888888888&888888888&&qpqoso .@&.&$@$$.$&$&@.*0*0.................................. @&&&&&&&&&&&&&&$. ....+$&&&&&%0.... ", +" [<[[[}|[&&888888888&88888888&8888888888&88&88888888&&opqpsps [<[[[}|[&&888888888&88888888&8888888888&88&88888888&&opqpsps .@&.$%.$$@&++&@.@*&+.................................. ................. .......@@@+...... ", +" <[[}[|[||&888888888&88888888&&&f88888888&&888888888&onqpsoss <[[}[|[||&888888888&88888888&&&f88888888&&888888888&onqpsoss .@&.0*.$$+*&**0..&$................................... ................. ................. ", +" [[}[|[|||&&&8888aba888888888&88&8888888888aba8888&&&nopsosss [[}[|[|||&&&8888aba888888888&88&8888888888aba8888&&&nopsosss ................+&@................................... ", +" }[[|[||||9|&&888b&b888888888&88&8888888888b&b888&&ononsqssss }[[|[||||9|&&888b&b888888888&88&8888888888b&b888&&ononsqssss ...............@&$.................................... ................... .................. ", +" [[|[||||9|99&&88aba888888888f&&f8888888888aba88&&ononsosssst [[|[||||9|99&&88aba888888888f&&f8888888888aba88&&ononsosssst ...................................................... ..........#$$$0.... ....#$$$$$$$$$$$.. ", +" [|}||||9|999e&&&88888888888888888888888888888&&&qpqpsosssstu [|}||||9|999e&&&88888888888888888888888888888&&&qpqpsosssstu ....+@................................................ ..........%&&&$.... ....$&&&&&&&&&&&.. ", +" |}4|4|9|999e9h9&&888888888888aba888888888888&&pqpqpsqsssstut |}4|4|9|999e9h9&&888888888888aba888888888888&&pqpqpsqsssstut ....@&................................................ .........=&&&&$.... ....*&&&&&&&&&&&.. ", +" [||||9|999e9h9hh&&&8888888888b&b8888888888&&&pqpqpsosssstutv [||||9|999e9h9hh&&&8888888888b&b8888888888&&&pqpqpsosssstutv ....@&.##.+@.###@...+@+............................... ........#&&&&&$.... ....&&&&&&&&&&&&.. ", +" ||4|9|99e9egehhhhi&&&&8888888aba8888888&&&&mononososssstutvt ||4|9|99e9egehhhhi&&&&8888888aba8888888&&&&mononososssstutvt ....@&.$$.@&.$%*%*.@&$%@.............................. .......+%&&&&&$.... ...#&&&&$$$$$$$$.. ", +" |4|9|99e9egehghhihiji&&&&&888888888&&&&&mnmononospsssstutvtv |4|9|99e9egehghhihiji&&&&&888888888&&&&&mnmononospsssstutvtv ....@&.$$.@&.$*.@&.%=@=%.............................. .......$&&&&&&$.... ...0&&&&.......... ", +" ||9|99e9egehhhhihijijkjll&&&&&&&&&&&mmmmnmononososssstutvtvw ||9|99e9egehhhhihijijkjll&&&&&&&&&&&mmmmnmononososssstutvtvw .00.@&.$$.@&.$$.@&.&*$$$.............................. ......@&&&&&&&$.... ...$&&&$.......... ", +" .=%@$%.$*.$&.$$.@&.*$.#+.............................. .....+%&&%*&&&$.... ...%&&&=.@@#...... ", +" .+*&%@.#%&$&.$$.@&.+*&&=.............................. .....$&&&@$&&&$.... ...&&&&*&&&&%0.... ", +" .......................................................... ...................................................... ....@&&&$.$&&&$.... ..@&&&&&&&&&&&$... ", +" ...@@+.................+@................................. ...................................................... ...+%&&%..$&&&$.... ..=&&&&&&&&&&&&=.. ", +" ..%&&&#................@&................................. ............................................................ ...................................................... ...*&&&#..$&&&$.... ..$&&&&&$$%&&&&&#. ", +" .@&#.=0.##.+@.###@...#@@&..#@#.+@..##..................... ............................................................ ....+@.......##....................................... ..0&&&=...$&&&$.... ..&&&&$+...0&&&&=. ", +" .#&%=+..$$.@&.$%*%*.=&$%&.0%$&=+&#.%0..................... ............................................................ ....@&.......$$....................................... .+&&&%....$&&&$.... ....+@......*&&&%. ", +" ..#*&&0.$$.@&.$*.@&.&0.0&.+++*$.*0+&+..................... ............................................................ ....@&.##.+@.$$+@..##................................. .$&&&*$$$$%&&&%$$0. ............@&&&&. ", +" .##.+=&.$$.@&.$$.@&.&@.@&.0%*%$.0*0*...................... ............................................................ ....@&.$$.@&.$$+&#.%0................................. .$&&&&&&&&&&&&&&&$. ............@&&&&. ", +" .0&0@$%.$*.$&.$$.@&.*$.$&.&0.*$..&*0...................... ............................................................ ....@&.$$.@&.$$.*0+&+................................. .$&&&&&&&&&&&&&&&$. .#$$%*......0&&&&. ", +" ..=&&*@.#%&$&.$$.@&.#%&$&.=&%$*..$&....................... ............................................................ .00.@&.$$.@&.$$.0*0*.................................. .$&&&&&&&&&&&&&&&$. .+&&&&+.....*&&&$. ", +" .................................*$....................... ............................................................ .=%@$%.$*.$&.$$..&*0.................................. .#@@@@@@@@*&&&*@@#. ..%&&&%+...$&&&&0. ", +" ................................&%+....................... ............................................................ .+*&%@.#%&$&.$$..$&................................... ..........$&&&$.... ..0&&&&&$$%&&&&%.. ", +" .......................................................... ............................................................ .................*$................................... ..........$&&&$.... ...*&&&&&&&&&&&#.. ", +" .......................................................... ............................................................ ................&%+................................... ..........$&&&$.... ...+%&&&&&&&&&@... ", +" .+@@..#@#................##............................... ............................................................ ...................................................... ..........$&&&$.... .....=%&&&&&$+.... ", +" .@&&..$&$................$$............................... ............................................................ ...+@+................................................ ................... .......#@@@....... ", +" .@&*@.&*$..#@+..@+@#...@#$$..@@+.##..@+................... ............................................................ ...*&$..........................+*.................... ................... .................. ", +" .@&==#%$$.$%$&@.&%$&0.%%*%$.***�%.#&+................... ............................................................ ..+&$&+.+@..@+.+@+@++@..@+.+@@..=&@................... ", +" .@&#$@$$$#&+.0%.&0.$$@&+.*$.#.#&@+&+0*.................... ............................................................ ..0&.&0.@&..&@#&**&@@&..&@+&$%*.*&$................... .................. ................. ", +" .@&.&$@$$@&..@&.&@.$$@&..$$.$&$&@.*0*0.................... ............................................................ ..*$.=*.@&..&@$*.+&@@&..&@@&0#+.@&.................... ......0$&&&$0..... .$$$$$$$$$$$$$$$. ", +" .@&.$%.$$+&@.$*.&@.$$+&@+%$@&++&@.@*&+.................... ............................................................ .+&&&&&+@&..&@$$..&@@&..&@.=%&$.@&.................... ....+%&&&&&&&$.... .&&&&&&&&&&&&&&&. ", +" .@&.0*.$$.@%&*+.&@.$$.0&%*$+*&**0..&$..................... ............................................................ .0%@@@%0@&+@&@=%+@&@@&+@&@#=.0&.@&.................... ...+%&&&&&&&&&$... .&&&&&&&&&&&&&&&. ", +" ..................................+&@..................... ............................................................ .*=...=*.*&$&@+*&=&@.*&$&@+*&&@.+%&................... ...%&&&&&&&&&&&#.. .&&&&&&&&&&&&&&&. ", +" .................................@&$...................... ............................................................ ..............#0.+&#.................................. ..0&&&&0..0&&&&=.. .$$$$$$$$$$&&&&@. ", +" .......................................................... ............................................................ ...............*&&=................................... ..*&&&0....$&&&%.. ..........$&&&0.. ", +" .......................................................... ............................................................ ...................................................... .+&&&&.....#$@@@.. .........@&&&$... ", +" .#@@@@#.....................##............................ ............................................................ ...@@+...............................+@............... .@&&&$............ ........+&&&&+... ", +" .$&&&&$.....................$$............................ ............................................................ ..%&&&#.............@=...............@&............... .0&&&$..@@@....... ........$&&&0.... ", +" ...$$..+@..@+..@#...#@#...@#$$..@@+.##..@+................ ............................................................ .@&#.=0..+@+..@+@#.+**#.+@+..@+@#.@+.@&+@+...@#..##@#. .$&&&@0%&&&&=+.... .......#&&&%..... ", +" ...$$..@&..&@+%**$.0%$&0.%%*%$.***�%.#&+................ ............................................................ .#&%=+..@&$%@.&%$&0#%%0@&$%@.&**&**&+@&**&#+%**$.$&$#. .$&&&%&&&&&&&%+... .......*&&&0..... ", +" ...$$..@&..&@=*@@&#$%@#.@&+.*$.#.#&@+&+0*................. ............................................................ ..#*&&0.%=@=%.&0.0%.$$.%=@=%.&0.&0.&@@&+.*$=*@@&#$*... .$&&&&&&&&&&&&%+.. ......#&&&%...... ", +" ...$$..@&..&@$%$$$#+$&&@@&..$$.$&$&@.*0*0................. ............................................................ .##.+=&.&*$$$.&@.@&.$$.&*$$$.&@.&@.&@@&..$$$%$$$#$$... .$&&&&&%$$&&&&&=.. ......$&&&=...... ", +" ...$$..@&+@&@0%++#.0@.*$+&@+%$@&++&@.@*&+................. ............................................................ .0&0@$%.*$.#+.&$.$*.$$.*$.#+.&@.&@.&@@&@+%00%++#.$$... .$&&&&$...+%&&&&.. .....+&&&&+...... ", +" ...$$...*&$&@.=&&*+@%&%+.0&%*$+*&**0..&$.................. ............................................................ ..=&&*@.+*&&=.&$&%+.@&$+*&&=.&@.&@.&@@&$&*..=&&*+$$... .$&&&%.....#&&&&#. .....0&&&*....... ", +" .....................................+&@.................. ............................................................ ..............&@...................................... .@&&&$......&&&&@. .....*&&&0....... ", +" ....................................@&$................... ............................................................ ..............&@...................................... .@&&&$......&&&&@. .....&&&&#....... ", +" .......................................................... ............................................................ ...................................................... ..&&&&+....#&&&&#. ....@&&&&........ ", +" .......................................................... ............................................................ ...+@@..................##............................ ..$&&&$+..+*&&&&.. ....=&&&*........ ", +" .@+..@#..##.........##.....................+@............. ............................................................ ..=&&&%@.......@=.......$$............................ ..#&&&&&$$&&&&&=.. ....$&&&$........ ", +" .*=.#&%..%0.........$$.....................@&............. ............................................................ .#&0.+$%..+@#.+**#.+@#..$$#@...+@+..@#@+.............. ...$&&&&&&&&&&%+.. ....%&&&0........ ", +" .$$.=*&+.&@.+@+...@#$$.@+@#...#@...+@@...#@@&..#@#.+@..##. ............................................................ .$*...+&@@&$%$#%%0@&$%$.$%*%%.@&$%@.&%$............... ....$&&&&&&&&%+... ....&&&&@........ ", +" .@&.*0*@@&.@&$%@.%%*%$.&%$&0.$%$%++&$%*.=&$%&.0%$&=+&#.%0. ............................................................ .$$....&@%0.++.$$.%0.+&#$*.+&@%=@=%.&0................ .....0%&&&&&=+.... ....&&&&@........ ", +" .+&+&#=$0*.%=@=%@&+.*$.&0.$$#&@@*=@&0#+.&0.0&.+++*$.*0+&+. ............................................................ .=%...#&#&@....$$.&@..&@$$..&@&*$$$.&@................ .......#@@#....... ................. ", +" ..%$&.@&$$.&*$$$@&..$$.&@.$$@&$$$0.=%&$.&@.@&.0%*%$.0*0*.. ............................................................ .+&*@0%*.*$.@0.$$.*$.@&+$%+@&+*$.#+.&@................ .................. ................. ", +" ..$%$..&%@.*$.#++&@+%$.&@.$$+&@.@.#=.0&.*$.$&.&0.*$..&*0.. ............................................................ ..#*&&=+.+*&%@.@&$+*&%@.$*%&0.+*&&=.&@................ ", +" ..0&@..$&+.+*&&=.0&%*$.&@.$$.@%&%@+*&&@.#%&$&.=&%$*..$&... ............................................................ ...................................................... .................. .................. ", +" .....................................................*$... ............................................................ ...................................................... .....@$%&&&$0+.... .....0$&&&$0...... ", +" ....................................................&%+... ............................................................ ...................................................... ...+*&&&&&&&&%@... ...+%&&&&&&&*+.... ", +" .......................................................... ............................................................ .+@#..##...........................@+................. ...%&&&&&&&&&&&#.. ..+%&&&&&&&&&%+... ", +" .......................................................... ............................................................ .@&%..$$...........................&@................. ..=&&&&*@@=&&&&%.. ..*&&&&&&&&&&&$... ", +" .#@@@@#+@.......................+@........................ ............................................................ .@&%0.$$..#@+.+@..##..@#..###@.##..&@@#...#@..+@#@.... ..%&&&*....0&&&&#. .#&&&&*#.+=&&&&#.. ", +" .$&&&&$@&.......................@&........................ ............................................................ .@&0%.$$.$%$&@#&+.*=+%**$.$%$&%$&0.&%$&=.$%$%+@&*0.... ..&&&&@.....&&&&@. .0&&&&+....=&&&=.. ", +" ...$$..@&+@+.+@..@++@#@.+@@...#@@&..#@#.+@..##............ ............................................................ .@&.%0$$#&+.0%.*@.&+=*@@&#$*.$*.$$.&0.0&#&@@*=@&+..... ..&&&&@.....&&&&@. .$&&&$.....+&&&%.. ", +" ...$$..@&**&+@&..&@@&*0+&$%*.=&$%&.0%$&=+&#.%0............ ............................................................ .@&.0%$$@&..@&.0*@*.$%$$$#$$.$$.$$.&@.@&@&$$$0@&...... ..*&&&=....#&&&&.. .$&&&$......&&&&.. ", +" ...$$..@&+.&@@&..&@@&+.@&0#+.&0.0&.+++*$.*0+&+............ ............................................................ .@&..%&$+&@.$*.+&*0.0%++#.$$.$$.$$.&$.$*+&@.@.@&...... ..#&&&&0..#%&&&=.. .$&&&*.....+&&&&#. ", +" ...$$..@&..&@@&..&@@&...=%&$.&@.@&.0%*%$.0*0*............. ............................................................ .@&..0&$.@%&*+..$&...=&&*+$$.$$.$$.&$&%#.@%&%@@&...... ...@&&&&&&&&&&$... .0&&&&@....$&&&&@. ", +" ...$$..@&..&@@&+@&@@&..#=.0&.*$.$&.&0.*$..&*0............. ............................................................ ...................................................... ....+%&&&&&&&@.... .+&&&&&=@@*&&&&&@. ", +" ...$$..@&..&@.*&$&@@&..+*&&@.#%&$&.=&%$*..$&.............. ............................................................ ...................................................... ...#%&&&&&&&&&0... ..=&&&&&&&&&&&&&@. ", +" ..........................................*$.............. ............................................................ ...................................................... ..+&&&&*@@=&&&&0.. ...$&&&&&&&&&&&&@. ", +" .........................................&%+.............. ............................................................ .+@@@@............................+@.................. ..*&&&*....0&&&&+. ....=&&&&&&=$&&&@. ", +" .......................................................... ............................................................ .@&&&&%+..........................@&.................. .+&&&&#.....%&&&0. .....+0$$=+.%&&&#. ", +" .......................................................... ............................................................ .@&..+%$..#@....@@...+@+..@+@#.@+.@&+@+...@#..##@#.... .@&&&&......$&&&$. ............&&&&.. ", +" .+@@@@+....+@....+@....................................... ............................................................ .@&...@&.$%$%++%**%+@&$%@.&**&**&+@&**&#+%**$.$&$#.... .@&&&&......$&&&$. ....+@.....#&&&%.. ", +" .@&&&&@....#$....@&....................................... .@&...@&#&@@*==*..#.%=@=%.&0.&0.&@@&+.*$=*@@&#$*...... .@&&&&#.....%&&&$. .@&&&&+....=&&&=.. ", +" .@&....+@#@+@..#@@&..#@#.+@..##........................... .@&...0%@&$$$0$$....&*$$$.&@.&@.&@@&..$$$%$$$#$$...... ..&&&&=....#&&&&@. ..&&&&$...@&&&&#.. ", +" .@&@@@.@&*0@&.=&$%&.0%$&=+&#.%0........................... .@&@@0&=+&@.@.0%++=+*$.#+.&@.&@.&@@&@+%00%++#.$$...... ..$&&&&=+.#%&&&%.. ..*&&&&%$*&&&&*... ", +" .@&&&&.@&+.@&.&0.0&.+++*$.*0+&+........................... .@&&&&=..@%&%@.=&&=.+*&&=.&@.&@.&@@&$&*..=&&*+$$...... ..+%&&&&&&&&&&&@.. ..#&&&&&&&&&&%+... ", +" .@&....@&..@&.&@.@&.0%*%$.0*0*............................ ...................................................... ...+%&&&&&&&&&0... ...=&&&&&&&&%+.... ", +" .@&....@&..@&.*$.$&.&0.*$..&*0............................ ...................................................... ....+=&&&&&&*#.... ....@%&&&&&=+..... ", +" .@&....@&..@&.#%&$&.=&%$*..$&............................. .......#@@@....... ......#@@#........ ", +" ...........................*$............................. .................. .................. ", +" ..........................&%+............................. ", +" .......................................................... ", +" .......................................................... ", +" ...@@+........................+@.......................... ", +" ..%&&&#.......@=..............@&.......................... ", +" .@&#.=0..#@#.+**###.+@.##@#.#@@&..#@#.+@..##.............. ", +" .#&%=+..0%$&=#%%0$$.@&.$&$#=&$%&.0%$&=+&#.%0.............. ", +" ..#*&&0.+++*$.$$.$$.@&.$*..&0.0&.+++*$.*0+&+.............. ", +" .##.+=&.0%*%$.$$.$$.@&.$$..&@.@&.0%*%$.0*0*............... ", +" .0&0@$%.&0.*$.$$.$*.$&.$$..*$.$&.&0.*$..&*0............... ", +" ..=&&*@.=&%$*.@&$#%&$&.$$..#%&$&.=&%$*..$&................ ", +" ........................................*$................ ", +" .......................................&%+................ ", +" .......................................................... "}; diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..76d2179 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,29 @@ +# This file is processed by GNU automake to generate Makefile.in + +INCLUDES = -I$(top_srcdir)/pixmaps + +bin_PROGRAMS = hvclock + +hvclock_SOURCES = hvclock.c hvclock.h clock.c clock.h calendar.c calendar.h \ + options.c options.h xevents.c xevents.h dockapp.c dockapp.h \ + common.h + +# These headers will be included in the distribution tarball, but will not be +# installed by 'make install' +noinst_HEADERS = + +CLEANFILES = *~ + +DISTCLEANFILES = .deps/*.P + +MAINTAINERCLEANFILES = Makefile.in + +# This rule is used to bypass the default rule which is generated by Automake, in order +# to get rid of all the cluttered informations that are displayed by Make before +# calling the compiler like in the following example: +# source='programming.c' object='programming.o' libtool=no \ +# depfile='.deps/programming.Po' tmpdepfile='.deps/programming.TPo' \ +# depmode=gcc3 /bin/sh ../config/depcomp \ +# gcc -DHAVE_CONFIG_H -I. -I. -I.. -c `test -f 'main.c' || echo './'`main.c +.c.o: + $(COMPILE) -c $< diff --git a/src/calendar.c b/src/calendar.c new file mode 100644 index 0000000..b9603d9 --- /dev/null +++ b/src/calendar.c @@ -0,0 +1,151 @@ +/* calendar.c -- functions for displaying calendar + Copyright (C) 2003 Hugo Villeneuve */ + + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#if STDC_HEADERS +# include +#elif HAVE_STRINGS_H +# include +#else +# error "Needs or " +#endif + +#include +#include +#include +#include + +#include "common.h" +#include "dockapp.h" +#include "xevents.h" +#include "options.h" +#include "calendar.h" + + +static const int number_widths[]={ + 18, /* 0 */ + 12, /* 1 */ + 17, /* 2 */ + 17, /* 3 */ + 19, /* 4 */ + 18, /* 5 */ + 18, /* 6 */ + 17, /* 7 */ + 18, /* 8 */ + 18 /* 9 */ +}; + +static const int months_widths[]={ + 39, /* January */ + 43, /* February */ + 29, /* March */ + 22, /* April */ + 20, /* May */ + 23, /* June */ + 20, /* July */ + 34, /* August */ + 52, /* September */ + 39, /* October */ + 49, /* November */ + 49 /* December */ +}; + +static const int days_widths[]={ + 36, /* Sunday */ + 38, /* Monday */ + 41, /* Tueday */ + 56, /* Wednesday */ + 45, /* Thursday */ + 30, /* Friday */ + 43 /* Saturday */ +}; + + +static int +DisplayDigit( int digit, int dest_x, int dest_y ) +{ + int src_x, src_y; + + if( ( digit % 2 ) == 0 ) + src_x = NUMBERS_SRC_X; /* First column */ + else + src_x = NUMBERS_SRC_X + NUMBERS_DELTA_X; /* Second column */ + + src_y = NUMBERS_SRC_Y + ( ( digit / 2 ) * NUMBERS_DELTA_Y ); + + copyXPMArea( src_x, src_y, number_widths[digit], NUMBERS_DELTA_Y - 1, + dest_x, dest_y ); + + return ( dest_x + number_widths[digit] + 1 ); +} + + +static int +GetNumberWidth( int number ) +{ + int first,second; + int width; + + first = number / 10; + second = number % 10; + + if( first == 0 ) + width = number_widths[second]; + else + width = number_widths[first] + number_widths[second]; + + return width; +} + + +void +UpdateCalendar( void ) +{ + struct tm *time_struct; + time_t curtime; + int x,y; + int day_of_month; + int day_of_week; + int month; + + curtime = time(CurrentTime); + time_struct = localtime(&curtime); + day_of_month = time_struct->tm_mday; + day_of_week = time_struct->tm_wday; + month = time_struct->tm_mon; + + /* Blanking the calendar area. */ + copyXPMArea( CALENDAR_BACKGROUND_SRC_X, CALENDAR_BACKGROUND_SRC_Y, 64, 64, + 0, 0 ); + + /* Displaying weekday. */ + x = ( 64 - days_widths[day_of_week] ) / 2; + y = 6; + copyXPMArea( WEEKDAYS_BASE_X, + WEEKDAYS_BASE_Y + WEEKDAYS_DELTA_Y * day_of_week, + days_widths[day_of_week], WEEKDAYS_HEIGHT, x, y ); + + /* Displaying month. */ + x = ( 64 - months_widths[month] ) / 2; + y += WEEKDAYS_DELTA_Y + 1; + copyXPMArea( MONTHS_BASE_X, MONTHS_BASE_Y + MONTHS_DELTA_Y * month, + months_widths[month], MONTHS_HEIGHT, x, y ); + + /* x is the position of the first digit. */ + x = ( 64 - GetNumberWidth( day_of_month ) ) / 2; + y += MONTHS_DELTA_Y + 2; + + if( ( day_of_month / 10 ) != 0 ) + x = DisplayDigit( day_of_month / 10, x, y ); + + (void) DisplayDigit( day_of_month % 10, x, y ); + + RedrawWindow(); +} diff --git a/src/calendar.h b/src/calendar.h new file mode 100644 index 0000000..591710a --- /dev/null +++ b/src/calendar.h @@ -0,0 +1,34 @@ +/* calendar.h */ + + +#ifndef CALENDAR_H +#define CALENDAR_H 1 + +/* Constants */ + +#define CALENDAR_BACKGROUND_SRC_X 64 +#define CALENDAR_BACKGROUND_SRC_Y 64 + +#define WEEKDAYS_BASE_X 3 +#define WEEKDAYS_BASE_Y 65 +#define WEEKDAYS_HEIGHT 10 +#define WEEKDAYS_DELTA_Y 12 + +#define MONTHS_BASE_X 130 +#define MONTHS_BASE_Y 1 +#define MONTHS_HEIGHT 10 +#define MONTHS_DELTA_Y 11 + +#define NUMBERS_SRC_X 184 +#define NUMBERS_SRC_Y 0 +#define NUMBERS_DELTA_X 20 +#define NUMBERS_DELTA_Y 27 + + +/* Functions */ + +void +UpdateCalendar( void ); + + +#endif /* CALENDAR_H */ diff --git a/src/clock.c b/src/clock.c new file mode 100644 index 0000000..c7efda8 --- /dev/null +++ b/src/clock.c @@ -0,0 +1,142 @@ +/* clock.c -- functions for displaying and rendering clock and calendar + Copyright (C) 2003 Hugo Villeneuve */ + + +/* Define filename_M */ +#define CLOCK_M 1 + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#if STDC_HEADERS +# include +#elif HAVE_STRINGS_H +# include +#else +# error "Needs or " +#endif + +#include +#include +#include +#include + +#include "common.h" +#include "dockapp.h" +#include "xevents.h" +#include "options.h" +#include "clock.h" + + +static const char *clock_cfg = +"bg_image gfx/2.png " +"second_hand " +" exact false " +" shape " +" origin 32 32 " +" color 255 255 255 " +" pgon " +" fill 1 " +" begin " +" v -3 20 " +" v 0 25 " +" v 3 20 " +" end " +" end " +" end " +"end " +"minute_hand " +" exact false " +" shape " +" origin 32 32 " +" color 255 255 255 " +" pgon " +" fill 1 " +" begin " +" v -2.0 -3.0 " +" v -0.5 20.0 " +" v 0.5 20.0 " +" v 2.0 -3.0 " +" end " +" end " +" end " +"end " +"hour_hand " +" exact false " +" shape " +" origin 32 32 " +" color 255 255 255 " +" pgon " +" fill 1 " +" begin " +" v -2.5 -3.0 " +" v -0.5 12.0 " +" v 0.5 12.0 " +" v 2.5 -3.0 " +" end " +" end " +" end " +"end"; + + +void +UpdateClock( void ) +{ + static int old_hour = 0; + static int old_minute = 0; + static int old_second = 0; + struct tm *time_struct; + time_t curtime; + double angle; + int x, y; + + curtime = time(NULL); + time_struct = localtime(&curtime); + + /* We should not update each second if the seconds hand is not displayed. */ + if( ( time_struct->tm_hour == old_hour ) && + ( time_struct->tm_min == old_minute ) && + ( time_struct->tm_sec == old_second ) ) + return; + + /* Blanking the clock area. */ + copyXPMArea( 64, 0, SIZE, SIZE, 0, 0 ); + + XSetLineAttributes( dockapp.display, dockapp.NormalGC, HAND_WIDTH, LineSolid, + CapRound, JoinRound ); + + angle = (M_PI / 6.0) * (double) time_struct->tm_hour + + (M_PI / 360.0) * (double) time_struct->tm_min; + x = (SIZE / 2) + (int) ((double) HOUR_HAND_LENGTH * sin(angle)); + y = (SIZE / 2) - (int) ((double) HOUR_HAND_LENGTH * cos(angle)); + XDrawLine( dockapp.display, dockapp.xpm_icon.image, dockapp.NormalGC, SIZE / 2, SIZE / 2, + x, y ); + + angle = (M_PI / 30.0) * (double) time_struct->tm_min; + x = (SIZE / 2) + (int) ((double) MINUTE_HAND_LENGTH * sin(angle)); + y = (SIZE / 2) - (int) ((double) MINUTE_HAND_LENGTH * cos(angle)); + XDrawLine( dockapp.display, dockapp.xpm_icon.image, dockapp.NormalGC, SIZE / 2, SIZE / 2, + x, y ); + + /* if (option.show_seconds) { + angle = (M_PI / 30.0) * (double) s; + sx = (SIZE / 2) + (int) ((double) option.second_hand_length * sin(angle)); + sy = (SIZE / 2) - (int) ((double) option.second_hand_length * cos(angle)); + + XSetForeground(display, gc, second_hand_pixel); + XSetLineAttributes(display, gc, option.second_hand_width, LineSolid, + CapRound, JoinRound); + XDrawLine(display, all_pm, gc, SIZE / 2, SIZE / 2, sx, sy); + XSetForeground(display, gc, hand_pixel); + }*/ + + RedrawWindow(); + + old_hour = time_struct->tm_hour; + old_minute = time_struct->tm_min; + old_second = time_struct->tm_sec; +} diff --git a/src/clock.h b/src/clock.h new file mode 100644 index 0000000..7265271 --- /dev/null +++ b/src/clock.h @@ -0,0 +1,21 @@ +/* clock.h */ + + +#ifndef CLOCK_H +#define CLOCK_H 1 + +/* Constants */ + +#define SIZE 64 +#define HAND_WIDTH 2 +#define HOUR_HAND_LENGTH 16 +#define MINUTE_HAND_LENGTH 25 + + +/* Functions */ + +void +UpdateClock( void ); + + +#endif /* CLOCK_H */ diff --git a/src/common.h b/src/common.h new file mode 100644 index 0000000..fa3b547 --- /dev/null +++ b/src/common.h @@ -0,0 +1,40 @@ +/* common.h */ + +#ifndef COMMON_H +#define COMMON_H 1 + + +#include +#include +#include + + +/* Common constants. */ +#ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# define EXIT_FAILURE 1 +#endif + +typedef int bool; +#ifndef FALSE +# define FALSE 0 +# define TRUE 1 +#endif + + +/* Returns TRUE if the strings 'a' and 'b' are equal. */ +#define STREQ(a, b) (strcmp((a), (b)) == 0) + +/* Returns TRUE if the first 'c' characters of strings 'a' and 'b' are equal. */ +#define STREQ_LEN(a, b, c) (strncmp((a), (b), (c)) == 0) + + +inline void +ErrorLocation( const char *file, int line ); + +/*@out@*/ /*@only@*/ +void * +xmalloc( size_t size, const char *filename, int line_number ); + + +#endif /* COMMON_H */ diff --git a/src/dockapp.c b/src/dockapp.c new file mode 100644 index 0000000..351637f --- /dev/null +++ b/src/dockapp.c @@ -0,0 +1,275 @@ +/* dockapp.c -- routines for managing dockapp windows and icons. */ + + +/* Define filename_M */ +#define DOCKAPP_M 1 + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common.h" +#include "dockapp.h" + + +static void +CreateIconFromXpmData( char *pixmap_data[] ) +{ + int status; + + dockapp.xpm_icon.attributes.valuemask |= + ( XpmReturnPixels | XpmReturnExtensions ); + + /* Using the XPM library to read XPM data from the array in the included XPM + file. The 'shapemask' Pixmap variable is set to an additional 1-bit deep + pixmap that can then be used as a shape mask for the XShapeCombineMask() + function. */ + status = XpmCreatePixmapFromData( dockapp.display, dockapp.root_win, + pixmap_data, &dockapp.xpm_icon.image, + &dockapp.xpm_icon.shapemask, + &dockapp.xpm_icon.attributes ); + if( status != XpmSuccess ) { + fprintf( stderr, "%s: XpmCreatePixmapFromData() failed\n", PACKAGE ); + ErrorLocation( __FILE__, __LINE__ ); + exit( EXIT_FAILURE ); + } +} + + +static Pixel +GetColor( char *name ) +{ + int status; + bool res; + XColor color; + XWindowAttributes attributes; + + status = XGetWindowAttributes( dockapp.display, dockapp.root_win, + &attributes ); + if( status == XLIB_FAILURE ) { + fprintf( stderr, "%s: XGetWindowAttributes() failed\n", PACKAGE ); + ErrorLocation( __FILE__, __LINE__ ); + exit( EXIT_FAILURE ); + } + + color.pixel = 0; + res = (bool) XParseColor( dockapp.display, attributes.colormap, name, + &color ); + if( res == FALSE ) { + fprintf( stderr, "%s: Can't parse %s.\n", PACKAGE, name ); + ErrorLocation( __FILE__, __LINE__ ); + exit( EXIT_FAILURE ); + } + + res = (bool) XAllocColor( dockapp.display, attributes.colormap, &color ); + if( res == FALSE ) { + fprintf( stderr, "%s: Can't allocate %s.\n", PACKAGE, name ); + ErrorLocation( __FILE__, __LINE__ ); + exit( EXIT_FAILURE ); + } + + return color.pixel; +} + + +static void +flush_expose( Window win ) +{ + XEvent dummy; + bool res = TRUE; + + while( res != FALSE ) { + res = (bool) XCheckTypedWindowEvent( dockapp.display, win, Expose, &dummy ); + } +} + + +void +RedrawWindow( void ) +{ + flush_expose( dockapp.iconwin ); + + (void) XCopyArea( dockapp.display, dockapp.xpm_icon.image, dockapp.iconwin, + dockapp.NormalGC, 0, 0, dockapp.xpm_icon.attributes.width, + dockapp.xpm_icon.attributes.height, 0, 0 ); + + flush_expose( dockapp.win ); + + (void) XCopyArea( dockapp.display, dockapp.xpm_icon.image, dockapp.win, + dockapp.NormalGC, 0, 0, dockapp.xpm_icon.attributes.width, + dockapp.xpm_icon.attributes.height, 0, 0 ); +} + + +void +copyXPMArea( int x, int y, unsigned int sx, unsigned int sy, int dx, int dy ) +{ + (void) XCopyArea( dockapp.display, dockapp.xpm_icon.image, + dockapp.xpm_icon.image, dockapp.NormalGC, x, y, sx, sy, + dx, dy ); +} + + +/******************************************************************************* + * New window creation and initialization for a Dockable Application + ******************************************************************************/ +void +InitDockAppWindow( int argc, char *argv[], char *pixmap_data[], + char *display_arg, char *geometry_arg ) +{ + XGCValues gcv; + XSizeHints size_hints; + XWMHints wm_hints; + int status; + int gravity = 0; /* Used to store the gravity value returned by XWMGeometry, + but not used. */ + + /* Opening a connection to the X server. */ + dockapp.display = XOpenDisplay( display_arg ); + if( dockapp.display == NULL ) { + fprintf( stderr, "%s: Can't open display: %s\n", PACKAGE, + XDisplayName( display_arg ) ); + ErrorLocation( __FILE__, __LINE__ ); + exit( EXIT_FAILURE ); + } + + dockapp.screen = DefaultScreen( dockapp.display ); + dockapp.root_win = RootWindow( dockapp.display, dockapp.screen ); + dockapp.d_depth = DefaultDepth( dockapp.display, dockapp.screen ); + + /* Create a window to hold the stuff */ + size_hints.flags = USSize | USPosition; + size_hints.x = 0; + size_hints.y = 0; + + /* Constructing window's geometry information. */ + /* XWMGeometry() returns an 'int', but Xlib documentation doesn't explain + it's meaning. */ + XWMGeometry( dockapp.display, dockapp.screen, geometry_arg, NULL, BWIDTH, + &size_hints, &size_hints.x, &size_hints.y, &size_hints.width, + &size_hints.height, &gravity ); + + size_hints.width = ICON_SIZE; + size_hints.height = ICON_SIZE; + dockapp.back_pix = GetColor("white"); + dockapp.fore_pix = GetColor("black"); + + dockapp.win = XCreateSimpleWindow( dockapp.display, dockapp.root_win, + size_hints.x, size_hints.y, + (unsigned int) size_hints.width, + (unsigned int) size_hints.height, + BWIDTH, dockapp.fore_pix, + dockapp.back_pix ); + + dockapp.iconwin = XCreateSimpleWindow( dockapp.display, dockapp.win, + size_hints.x, size_hints.y, + (unsigned int) size_hints.width, + (unsigned int) size_hints.height, + BWIDTH, dockapp.fore_pix, + dockapp.back_pix ); + + /* Configuring Client to Window Manager Communications. */ + + /* WM_NORMAL_HINTS property: size hints for a window in it's normal state. */ + /* Replaces the size hints for the WM_NORMAL_HINTS property on the specified + window. */ + XSetWMNormalHints( dockapp.display, dockapp.win, &size_hints ); + + /* Setting the WM_CLASS property. */ + { + char *app_name = argv[0]; + XClassHint wm_class; + + /* The res_name member contains the application name. + The res_class member contains the application class. */ + /* The name set in this property may differ from the name set as WM_NAME. + That is, WM_NAME specifies what should be displayed in the title bar and, + therefore, can contain temporal information (for example, the name of a + file currently in an editor's buffer). On the other hand, the name + specified as part of WM_CLASS is the formal name of the application that + should be used when retrieving the application's resources from the + resource database. */ + wm_class.res_name = app_name; + wm_class.res_class = app_name; + (void) XSetClassHint( dockapp.display, dockapp.win, &wm_class ); + } + + /* Setting the WM_NAME property. + This specifies what should be displayed in the title bar (usually the + application name). */ + { + XTextProperty text_prop; + + char *app_name = argv[0]; + const int string_count = 1; + + status = XStringListToTextProperty( &app_name, string_count, &text_prop ); + if( status == 0 ) { + fprintf( stderr, "%s: XStringListToTextProperty() failed\n", PACKAGE ); + ErrorLocation( __FILE__, __LINE__ ); + exit( EXIT_FAILURE ); + } + + XSetWMName( dockapp.display, dockapp.win, &text_prop ); + + /* Freing the storage for the value field. */ + (void) XFree( text_prop.value ); + } + + /* WM_HINTS --> Additional hints set by the client for use by the Window + Manager. */ + /* XWMHints wm_hints; */ + + /* WithdrawnState, NormalState or IconicState. Must be set to WithdrawnState + for DockApp. */ + wm_hints.flags = StateHint | IconWindowHint | IconPositionHint | + WindowGroupHint; + wm_hints.initial_state = WithdrawnState; /* Withdrawn, Normal */ + wm_hints.icon_window = dockapp.iconwin; + wm_hints.icon_x = size_hints.x; + wm_hints.icon_y = size_hints.y; + wm_hints.window_group = dockapp.win; + (void) XSetWMHints( dockapp.display, dockapp.win, &wm_hints ); + + /* Sets the WM_COMMAND property. This sets the command and arguments used to + invoke the application. */ + (void) XSetCommand( dockapp.display, dockapp.win, argv, argc ); + + /* ... */ + (void) XSelectInput( dockapp.display, dockapp.win, + ButtonPressMask | ExposureMask | ButtonReleaseMask | + PointerMotionMask | StructureNotifyMask ); + + (void) XSelectInput( dockapp.display, dockapp.iconwin, + ButtonPressMask | ExposureMask | ButtonReleaseMask | + PointerMotionMask | StructureNotifyMask ); + + /* Create GC for drawing */ + gcv.foreground = dockapp.fore_pix; + gcv.background = dockapp.back_pix; + gcv.graphics_exposures = 0; + dockapp.NormalGC = XCreateGC( dockapp.display, dockapp.root_win, + GCForeground | GCBackground | + GCGraphicsExposures, &gcv ); + + /* Convert XPM data to XImage */ + CreateIconFromXpmData( pixmap_data ); + + XShapeCombineMask( dockapp.display, dockapp.win, ShapeBounding, 0, 0, + dockapp.xpm_icon.shapemask, ShapeSet ); + + XShapeCombineMask( dockapp.display, dockapp.iconwin, ShapeBounding, 0, 0, + dockapp.xpm_icon.shapemask, ShapeSet ); + + /* Making the new window visible. */ + (void) XMapWindow( dockapp.display, dockapp.win ); +} diff --git a/src/dockapp.h b/src/dockapp.h new file mode 100644 index 0000000..996f6c1 --- /dev/null +++ b/src/dockapp.h @@ -0,0 +1,64 @@ +/* dockapp.h */ + +#ifndef DOCKAPP_H +#define DOCKAPP_H 1 + + +#include + + +#define XLIB_FAILURE 0 +#define XLIB_SUCCESS 1 + +/* Specifies the border width */ +#define BWIDTH 1 + +/* Width and height in pixels of Window Maker icons. */ +#define ICON_SIZE 64 + + +typedef struct XpmIcon +{ + XpmAttributes attributes; + Pixmap shapemask; + Pixmap image; +} XpmIcon; + +typedef struct dockapp_t +{ + Display *display; + Window root_win; + int screen; + int d_depth; + Pixel back_pix; + Pixel fore_pix; + Window iconwin; + Window win; + GC NormalGC; + XpmIcon xpm_icon; +} dockapp_t; + + +void +InitDockAppWindow( int argc, char *argv[], char *pixmap_data[], + char *display_arg, char *geometry_arg ); + +void +RedrawWindow( void ); + +void +copyXPMArea( int x, int y, unsigned int sx, unsigned int sy, int dx, int dy ); + + +/* Exported variables */ +#undef _SCOPE_ +#ifdef DOCKAPP_M +#define _SCOPE_ /**/ +#else +#define _SCOPE_ extern +#endif + +_SCOPE_ dockapp_t dockapp; + + +#endif /* DOCKAPP_H */ diff --git a/src/hvclock.c b/src/hvclock.c new file mode 100644 index 0000000..f0ecc80 --- /dev/null +++ b/src/hvclock.c @@ -0,0 +1,196 @@ +/* hvclock.c -- main program + Copyright (C) 2003 Hugo Villeneuve */ + + +/* Define filename_M */ +#define HVCLOCK_M 1 + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#if STDC_HEADERS +# include +#elif HAVE_STRINGS_H +# include +#else +# error "Needs or " +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common.h" +#include "dockapp.h" +#include "xevents.h" +#include "options.h" +#include "hvclock.xpm" +#include "clock.h" +#include "calendar.h" +#include "hvclock.h" + + +/* Thread ID */ +static pthread_t timer_thread; + +static int mode = CLOCK_MODE; + + +inline void +ErrorLocation( const char *file, int line ) +{ + fprintf( stderr, " Error in file \"%s\" at line #%d\n", file, line ); +} + + +void * +xmalloc( size_t size, const char *filename, int line_number ) +{ + void *value; + + value = malloc( size ); + + if( value == NULL ) { + perror( PACKAGE ); + ErrorLocation( filename, line_number ); + exit( EXIT_FAILURE ); + } + + return value; +} + + +static void +CatchTimerSignal( /*@unused@*/ int signal ) +{ +#if defined(DEBUG) + printf( "%s: Catching signal SIGUSR1.\n", PACKAGE ); +#endif +} + + +static void +SingleClick( void ) +{ + int status; + +#if defined(DEBUG) + printf( "%s: SingleClick() Entry\n", PACKAGE ); +#endif + + /* single-click --> changing viewing mode */ + if( mode == CLOCK_MODE ) + mode = CALENDAR_MODE; + else + mode = CLOCK_MODE; + + /* Sending a signal to awake the TimerThread() thread. */ + status = pthread_kill( timer_thread, SIGUSR1 ); + if( status != EXIT_SUCCESS ) { + fprintf( stderr, "%s: pthread_kill() error (%d)\n", PACKAGE, status ); + ErrorLocation( __FILE__, __LINE__ ); + exit( EXIT_FAILURE ); + } + +#if defined(DEBUG) + printf( "%s: SingleClick() Exit\n", PACKAGE ); +#endif +} + + +static void * +TimerThread( /*@unused@*/ void *arg ) +{ + unsigned int time_remaining; + unsigned int thread_sleep_time; + + thread_sleep_time = 1; /* Updates done at 5 seconds interval. */ + + /* For catching the termination signal SIGUSR1. This signal is sent by the + main program thread when the user is issuing a single-click to switch + modes. */ + (void) signal( SIGUSR1, CatchTimerSignal ); + + while( TRUE ) { + if( mode == CLOCK_MODE ) { + UpdateClock(); + } + else { + UpdateCalendar(); + } + + /* If sleep() returns because the requested time has elapsed, the value + returned will be 0. If sleep() returns because of premature arousal due + to delivery of a signal, the return value will be the "unslept" amount + (the requested time minus the time actually slept) in seconds. */ + time_remaining = sleep( thread_sleep_time ); + if( time_remaining != 0 ) { +#if defined(DEBUG) + printf( "%s: TimerThread() interrupted by signal\n", PACKAGE ); +#endif + } + } + + /* This code is never reached... */ + pthread_exit( NULL ); +} + + +/******************************************************************************* + * Main function + ******************************************************************************/ +int +main( int argc, char *argv[] ) +{ + int status; + + /* Initialization */ + ParseCommandLineOptions( argc, argv ); + + /* We must call gdk_init_check() manually. Gtk+ or Gnome applications don't need to do + that because gtk_init() or gnome_init() do it automatically. */ + status = gdk_init_check( &argc, &argv ); + if( status == 0 ) { + fprintf( stderr, + "%s: GDK initialization failed, check your $DISPLAY environment variable\n", + PACKAGE ); + ErrorLocation( __FILE__, __LINE__ ); + exit( EXIT_FAILURE ); + } + + (void) gdk_rgb_init(); + + /* Initialize callback function pointers. */ + ProcessXlibEventsInit( SingleClick, NULL ); + + /* Initializing and creating a DockApp window. */ + InitDockAppWindow( argc, argv, hvclock_xpm, hvclock_infos.display_arg, + hvclock_infos.geometry_arg ); + + /* Starting thread for periodically checking for new mail. */ + status = pthread_create( &timer_thread, NULL, TimerThread, NULL ); + if( status != 0 ) { + fprintf( stderr, "%s: Thread creation failed (%d)\n", PACKAGE, status ); + ErrorLocation( __FILE__, __LINE__ ); + exit( EXIT_FAILURE ); + } + + /* Main loop, processing X Events */ + ProcessXlibEvents(); + + /* This code is never reached for now. */ + fprintf( stderr, "%s: Program exit\n", PACKAGE ); + + exit( EXIT_SUCCESS ); +} diff --git a/src/hvclock.h b/src/hvclock.h new file mode 100644 index 0000000..cb02f70 --- /dev/null +++ b/src/hvclock.h @@ -0,0 +1,29 @@ +/* hvclock.h */ + + +#ifndef HVCLOCK_H +#define HVCLOCK_H 1 + +/* Constants */ +#define CLOCK_MODE 0 +#define CALENDAR_MODE 1 + + +typedef struct hvclock_t +{ + char *display_arg; + char *geometry_arg; +} hvclock_t; + +/* Exported variables */ +#undef _SCOPE_ +#ifdef HVCLOCK_M +# define _SCOPE_ /**/ +#else +# define _SCOPE_ extern +#endif + +_SCOPE_ hvclock_t hvclock_infos; + + +#endif /* HVCLOCK_H */ diff --git a/src/options.c b/src/options.c new file mode 100644 index 0000000..263d5bf --- /dev/null +++ b/src/options.c @@ -0,0 +1,131 @@ +/* options.c -- functions for processing command-line options and arguments + Copyright (C) 2003 Hugo Villeneuve */ + + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include + +#if STDC_HEADERS +# include +#elif HAVE_STRINGS_H +# include +#endif + +#include "common.h" +#include "hvclock.h" +#include "options.h" + + +/******************************************************************************* + * Display the help message and exit + ******************************************************************************/ +static void +DisplayUsage( void ) +{ + printf( "Usage: %s [OPTIONS]...\n", PACKAGE ); + printf( "Dockable analog clock and calendar.\n\n" ); + printf( " -display X display name\n" ); + printf( " -geometry +XPOS+YPOS initial window position\n" ); + printf( " -h display this help and exit\n" ); + printf( " -version display version information and exit\n"); + printf( "\n" ); +} + + +/******************************************************************************* + * Display version information and exit + ******************************************************************************/ +static void +DisplayVersion( void ) +{ + printf( "\n" ); + printf( " %s, version %s\n", PACKAGE, VERSION ); + printf( " Written by Hugo Villeneuve\n\n" ); +} + + +static void +InvalidOption( char *message, /*@null@*/ char *string ) +{ + if( string == NULL ) + fprintf(stderr, "%s: %s\n", PACKAGE, message ); + else + fprintf(stderr, "%s: %s %s\n", PACKAGE, message, string ); + + fprintf(stderr, "Try `%s -h' for more information.\n", PACKAGE ); + + exit( EXIT_FAILURE ); +} + + +/******************************************************************************* + * Initializes the different options passed as arguments on the command line. + ******************************************************************************/ +void +ParseCommandLineOptions( int argc, char *argv[] ) +{ + int i; + char *token; + bool display_on = FALSE; + bool geometry_on = FALSE; + + for( i = 1; i < argc; i++ ) { + token = argv[i]; + switch( token[0] ) { + case '-': + /* Processing options names */ + switch( token[1] ) { + case 'd': + if( STREQ( "display", &token[1] ) ) { + display_on = TRUE; + } + break; + case 'g': + if( STREQ( "geometry", &token[1] ) ) { + geometry_on = TRUE; + } + break; + case 'h': + DisplayUsage(); + exit( EXIT_SUCCESS ); + case 'v' : + if( STREQ( "version", &token[1] ) ) { + DisplayVersion(); + exit( EXIT_SUCCESS ); + } + InvalidOption( "invalid option", token ); + break; + default: + InvalidOption( "invalid option", token ); + break; + } /* end switch( token[1] ) */ + break; + default: + /* Processing options arguments */ + if( display_on != FALSE ) { + display_on = FALSE; + hvclock_infos.display_arg = token; + } + else if( geometry_on != FALSE ) { + geometry_on = FALSE; + hvclock_infos.geometry_arg = token; + } + else { + InvalidOption( "invalid option", token ); + } + break; + } /* end switch( token[0] ) */ + } /* end for */ + + if( display_on != FALSE ) { + InvalidOption( "missing display parameter", NULL ); + } + else if( geometry_on != FALSE ) { + InvalidOption( "missing geometry parameter", NULL ); + } +} diff --git a/src/options.h b/src/options.h new file mode 100644 index 0000000..88026aa --- /dev/null +++ b/src/options.h @@ -0,0 +1,11 @@ +/* options.h */ + +#ifndef OPTIONS_H +#define OPTIONS_H 1 + + +void +ParseCommandLineOptions( int argc, char *argv[] ); + + +#endif /* OPTIONS_H */ diff --git a/src/xevents.c b/src/xevents.c new file mode 100644 index 0000000..eafe36f --- /dev/null +++ b/src/xevents.c @@ -0,0 +1,118 @@ +/* xevents.c -- handling X events, and detecting single-click and double-click + * mouse events. */ + + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "common.h" +#include "dockapp.h" +#include "xevents.h" + + +/* Function pointers to handle single and double mouse click events. */ +void (*SingleClickCallback)( void ) = NULL; + +void (*DoubleClickCallback)( void ) = NULL; + + +/* This function must be called at the beginning of your program to initialize + the function pointers to handle single and double click mouse events. */ +void +ProcessXlibEventsInit( void (*single_click_callback)( void ), + void (*double_click_callback)( void ) ) +{ + int status; + + /* This must be called before any other XLib functions. */ + status = XInitThreads(); + if( status == 0 ) { + fprintf( stderr, "%s: XInitThreads() initialization failed\n", PACKAGE ); + ErrorLocation( __FILE__, __LINE__ ); + exit( EXIT_FAILURE ); + } + + SingleClickCallback = single_click_callback; + DoubleClickCallback = double_click_callback; +} + + +/* Processing of X events */ +void +ProcessXlibEvents( void ) +{ + bool quit = FALSE; + bool button1_pressed = FALSE; + bool check_for_double_click = FALSE; + XEvent Event; + + while( quit == FALSE ) { + if( ( check_for_double_click != FALSE ) && + ( XPending( dockapp.display ) == 0 ) ) { + /* If no other button 1 events are received after the delay, then it is a + single-click mouse event. */ + if( SingleClickCallback != NULL ) { + (*SingleClickCallback)(); + } + + check_for_double_click = FALSE; + } + /* XNextEvent is a blocking call: it will return only when an event is + ready to be processed, thus freeing the CPU for other tasks when no + events are available. */ + (void) XNextEvent( dockapp.display, &Event ); + switch( Event.type ) { + case Expose: + /* Window was uncovered... */ + RedrawWindow(); + break; + case DestroyNotify: + /* Window was killed... */ + /* Is this necessary ? */ + (void) XCloseDisplay( dockapp.display ); + quit = TRUE; + break; + case ClientMessage: + /* Doesn't seem to work... */ + printf( "Client message received...\n" ); + break; + case ButtonPress: + if( Event.xbutton.button == Button1 ) { + /* Mouse LEFT button pressed. */ + button1_pressed = TRUE; + } + break; + case ButtonRelease: + if( Event.xbutton.button == Button1 ) { + /* Mouse LEFT button released. */ + if( button1_pressed != FALSE ) { + /* We act only when the button is released */ + if( check_for_double_click != FALSE ) { + /* Double-click */ + if( DoubleClickCallback != NULL ) { + (*DoubleClickCallback)(); + } + check_for_double_click = FALSE; + } + else { + (void) usleep( DOUBLE_CLICK_MAX_INTERVAL_MS * 1000 ); + check_for_double_click = TRUE; + } + } + } + break; + } + } /* end while */ +} diff --git a/src/xevents.h b/src/xevents.h new file mode 100644 index 0000000..1d1e362 --- /dev/null +++ b/src/xevents.h @@ -0,0 +1,20 @@ +/* xevents.h */ + +#ifndef XEVENTS_H +#define XEVENTS_H 1 + + +/* Maximum time between mouse double-clicks, in milliseconds */ +#define DOUBLE_CLICK_MAX_INTERVAL_MS 250 + + +void +ProcessXlibEventsInit( void (*single_click_callback)( void ), + void (*double_click_callback)( void ) ); + +void +ProcessXlibEvents( void ); + + +#endif /* XEVENTS_H */ +